From af16c0f612167274f740be1cd0a0829184987288 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Thu, 4 Apr 2019 15:51:09 -0700 Subject: [PATCH] Revert "stopgap implementation of second uv layer, see issue #8" This breaks exports, reverting until I figure out what I missed. This reverts commit dfee9ee49cc69b87889875834f89bac28caabaff. --- blender-2.80/exm_export.py | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/blender-2.80/exm_export.py b/blender-2.80/exm_export.py index b3afe9e..40317ca 100644 --- a/blender-2.80/exm_export.py +++ b/blender-2.80/exm_export.py @@ -15,7 +15,7 @@ bl_info = { "name": "Export Excessive Model (.exm/.iqm)", "author": "Lee Salzman, Colby Klein", - "version": (2019, 4, 4), + "version": (2018, 12, 5), "blender": (2, 80, 0), "location": "File > Export > Excessive Model", "description": "Export to the Excessive Model format (.exm/.iqm)", @@ -38,12 +38,7 @@ IQM_BLENDINDEXES = 4 IQM_BLENDWEIGHTS = 5 IQM_COLOR = 6 -IQM_CUSTOM = 0x10 - -# NB: this is INTENTIONALLY UNDOCUMENTED AND UNFINISHED. -# it's outside of spec, index subject to change! please give feedback on issue -# #8 if you use this feature. -EXM_TEXCOORD2 = IQM_CUSTOM + 0x10 +# IQM_CUSTOM = 0x10 # IQM_BYTE = 0 IQM_UBYTE = 1 @@ -69,12 +64,11 @@ MAXVCACHE = 32 class Vertex: - def __init__(self, index, coord, normal, uv, weights, color, uv2 = None): + def __init__(self, index, coord, normal, uv, weights, color): self.index = index self.coord = coord self.normal = normal self.uv = uv - self.uv2 = uv2 self.weights = weights self.color = color @@ -127,7 +121,7 @@ def __hash__(self): return self.index def __eq__(self, v): - return self.coord == v.coord and self.normal == v.normal and self.uv == v.uv and self.weights == v.weights and self.color == v.color and self.uv2 == v.uv2 + return self.coord == v.coord and self.normal == v.normal and self.uv == v.uv and self.weights == v.weights and self.color == v.color class Mesh: @@ -513,13 +507,9 @@ def writeVerts(self, file, offset): file.write(IQM_VERTEXARRAY.pack(IQM_BLENDWEIGHTS, 0, IQM_UBYTE, 4, offset)) offset += self.numverts * struct.calcsize('<4B') hascolors = any(mesh.verts and mesh.verts[0].color for mesh in self.meshes) - hasuv2 = any(mesh.verts and mesh.verts[0].uv2 for mesh in self.meshes) if hascolors: file.write(IQM_VERTEXARRAY.pack(IQM_COLOR, 0, IQM_UBYTE, 4, offset)) offset += self.numverts * struct.calcsize('<4B') - if hasuv2: - file.write(IQM_VERTEXARRAY.pack(EXM_TEXCOORD2, 0, IQM_FLOAT, 2, offset)) - offset += self.numverts * struct.calcsize('<2f') for mesh in self.meshes: for v in mesh.verts: @@ -547,10 +537,6 @@ def writeVerts(self, file, offset): file.write(struct.pack('<4B', v.color[0], v.color[1], v.color[2], v.color[3])) else: file.write(struct.pack('<4B', 0, 0, 0, 255)) - if hasuv2: - for mesh in self.meshes: - for v in mesh.verts: - file.write(struct.pack('<2f', *v.uv2)) def calcNeighbors(self): edges = {} @@ -931,13 +917,9 @@ def collectMeshes(context, bones, scale, matfun, usemodifiers = True, useskel = groups = obj.vertex_groups uvfaces = None - lightuvfaces = None for uv_layer in data.uv_layers: if uv_layer.active: uvfaces = uv_layer.data - else: - lightuvfaces = uv_layer.data - if uvfaces and lightuvfaces: break colors = None @@ -997,13 +979,6 @@ def collectMeshes(context, bones, scale, matfun, usemodifiers = True, useskel = else: vertuv = mathutils.Vector((0.0, 0.0)) - # flip V axis of texture space - if lightuvfaces: - uv2 = lightuvfaces[loop_index].uv - vertuv2 = mathutils.Vector((uv2[0], 1.0 - uv2[1])) - else: - vertuv2 = mathutils.Vector((0.0, 0.0)) - if colors: vertcol = colors[loop_index].color vertcol = (int(round(vertcol[0] * 255.0)), int(round(vertcol[1] * 255.0)), int(round(vertcol[2] * 255.0)), 255) @@ -1029,13 +1004,13 @@ def collectMeshes(context, bones, scale, matfun, usemodifiers = True, useskel = if not tri.use_smooth: vertindex = len(verts) - vertkey = Vertex(vertindex, vertco, vertno, vertuv, vertweights, vertcol, vertuv2) + vertkey = Vertex(vertindex, vertco, vertno, vertuv, vertweights, vertcol) vertkey.normalizeWeights() mesh.verts.append(vertkey) faceverts.append(vertkey) continue - vertkey = Vertex(v.index, vertco, vertno, vertuv, vertweights, vertcol, vertuv2) + vertkey = Vertex(v.index, vertco, vertno, vertuv, vertweights, vertcol) vertkey.normalizeWeights() if not verts[v.index]: verts[v.index] = vertkey @@ -1307,7 +1282,6 @@ def execute(self, context): global_matrix = axis_conversion(to_up="Z", to_forward="Y").to_4x4() exm_meta = "" - # disabled in git due to unspecified nature. # exm_meta = getJSON(context, self.properties.filepath, global_matrix) exportIQM(context, self.properties.filepath, self.properties.usemesh, self.properties.usemodifiers, self.properties.useskel, self.properties.usebbox, self.properties.usecol, self.properties.meshopt, matfun, derigify, self.properties.boneorder, flipyz, reversewinding, exm_meta, self.properties.selected_only)