diff --git a/obj2gbs.py b/obj2gbs.py index 808ffb9..e33764a 100644 --- a/obj2gbs.py +++ b/obj2gbs.py @@ -4,6 +4,7 @@ from lib.packet import Packet from lib.fileutils import * from lib.game import Vec3, VecRGB, cross import argparse +import sys GBS_VERSION = 0xaa0100be GBSFlagNormals = 0x0001 @@ -379,8 +380,18 @@ class GbsData: num_faces = sum([len(o.faces) for o in objects]) print("%s vertices, %s uvs, %s normals, %s objects, %s materials, %s faces" % (len(vertices), len(uvs), len(normals), len(objects), len(materials), num_faces)) - # assert len(objects) >= len(materials) - assert len(vertices) < 0xffff + + try: + assert(len(vertices) < 32000) + except AssertionError: + print("Your model has %s vertices. Giants only supports a maximum of 32k vertices" % len(vertices)) + sys.exit(1) + + try: + assert(len(uv_ind) < 0xffff) + except AssertionError: + print("Your model has %s UV. Giants only supports a maximum of 65k UV per model" % len(uv_ind)) + sys.exit(1) len_vertices = len(vertices) len_normals = len(normals)