From f1f51485849b3faef92139634fa329b14498c11f Mon Sep 17 00:00:00 2001 From: TigerKat Date: Mon, 22 Jul 2019 10:27:56 +0930 Subject: [PATCH] bugfix: Wasn't exporting weight bones correctly. --- __init__.py | 2 +- export_geo.py | 2 +- geo.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/__init__.py b/__init__.py index d5ed82e..ca83f7b 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ bl_info = { "name": "City of Heroes (.geo)", "author": "TigerKat", - "version": (0, 1), + "version": (0, 1, 1), "blender": (2, 79, 0), "location": "File > Import/Export,", "description": "City of Heroes (.geo)", diff --git a/export_geo.py b/export_geo.py index 13f9006..9ee122f 100644 --- a/export_geo.py +++ b/export_geo.py @@ -70,7 +70,7 @@ def save(operator, context, filepath = "", global_matrix = None, use_mesh_modifi geo = Geo() geo.getTextureIndex("white.tga") - geo.getTextureIndex("white") + #geo.getTextureIndex("white") body_name = bpy.path.display_name_from_filepath(filepath) geo.setName(body_name) diff --git a/geo.py b/geo.py index d5b2db3..bfba493 100755 --- a/geo.py +++ b/geo.py @@ -956,6 +956,8 @@ class Model: weight_remap = [] for i in range(len(geomesh.weights)): weight_remap.append(BONES_LOOKUP.get(geomesh.weights[i], 0)) + if len(weight_remap) <= 0: + weight_remap.append(0) #Convert vetices to: positions, normals, uvs, weights for i, v in enumerate(geomesh.geovertex): self.verts.append(v.coord) @@ -965,13 +967,13 @@ class Model: weights = v.selectWeights(2) if len(weights) == 0: self.weights.append([1, 0]) - self.weight_bones.append([0, 0]) + self.weight_bones.append([weight_remap[0], weight_remap[0]]) elif len(weights) == 1: self.weights.append([weights[0][1], 0]) - self.weight_bones.append([weights[0][0], 0]) + self.weight_bones.append([weight_remap[weights[0][0]], weight_remap[weights[0][0]]]) else: self.weights.append([weights[0][1], weights[1][1]]) - self.weight_bones.append([weights[0][0], weights[1][0]]) + self.weight_bones.append([weight_remap[weights[0][0]], weight_remap[weights[1][0]]]) #Convert faces texture_index = None texture_count = 0