bugfix: Wasn't exporting weight bones correctly.

master
TigerKat 5 years ago
parent 8d3a030b8b
commit f1f5148584

@ -2,7 +2,7 @@
bl_info = { bl_info = {
"name": "City of Heroes (.geo)", "name": "City of Heroes (.geo)",
"author": "TigerKat", "author": "TigerKat",
"version": (0, 1), "version": (0, 1, 1),
"blender": (2, 79, 0), "blender": (2, 79, 0),
"location": "File > Import/Export,", "location": "File > Import/Export,",
"description": "City of Heroes (.geo)", "description": "City of Heroes (.geo)",

@ -70,7 +70,7 @@ def save(operator, context, filepath = "", global_matrix = None, use_mesh_modifi
geo = Geo() geo = Geo()
geo.getTextureIndex("white.tga") geo.getTextureIndex("white.tga")
geo.getTextureIndex("white") #geo.getTextureIndex("white")
body_name = bpy.path.display_name_from_filepath(filepath) body_name = bpy.path.display_name_from_filepath(filepath)
geo.setName(body_name) geo.setName(body_name)

@ -956,6 +956,8 @@ class Model:
weight_remap = [] weight_remap = []
for i in range(len(geomesh.weights)): for i in range(len(geomesh.weights)):
weight_remap.append(BONES_LOOKUP.get(geomesh.weights[i], 0)) 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 #Convert vetices to: positions, normals, uvs, weights
for i, v in enumerate(geomesh.geovertex): for i, v in enumerate(geomesh.geovertex):
self.verts.append(v.coord) self.verts.append(v.coord)
@ -965,13 +967,13 @@ class Model:
weights = v.selectWeights(2) weights = v.selectWeights(2)
if len(weights) == 0: if len(weights) == 0:
self.weights.append([1, 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: elif len(weights) == 1:
self.weights.append([weights[0][1], 0]) 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: else:
self.weights.append([weights[0][1], weights[1][1]]) 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 #Convert faces
texture_index = None texture_index = None
texture_count = 0 texture_count = 0

Loading…
Cancel
Save