bugfix [#23935] Exporting to Unity3d .fbx Blender 2.5

This commit is contained in:
Campbell Barton 2010-09-22 12:36:54 +00:00
parent b27d924aac
commit 12628b197d
2 changed files with 25 additions and 10 deletions

@ -86,7 +86,25 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
import io_scene_fbx.export_fbx import io_scene_fbx.export_fbx
return io_scene_fbx.export_fbx.save(self, context, GLOBAL_MATRIX=GLOBAL_MATRIX, **self.properties) return io_scene_fbx.export_fbx.save(self, context, self.filepath,
GLOBAL_MATRIX=GLOBAL_MATRIX,
EXP_OBS_SELECTED=self.EXP_OBS_SELECTED,
EXP_MESH=self.EXP_MESH,
EXP_MESH_APPLY_MOD=self.EXP_MESH_APPLY_MOD,
EXP_ARMATURE=self.EXP_ARMATURE,
EXP_LAMP=self.EXP_LAMP,
EXP_CAMERA=self.EXP_CAMERA,
EXP_EMPTY=self.EXP_EMPTY,
EXP_IMAGE_COPY=self.EXP_IMAGE_COPY,
ANIM_ENABLE=self.ANIM_ENABLE,
ANIM_OPTIMIZE=self.ANIM_OPTIMIZE,
ANIM_OPTIMIZE_PRECISSION=self.ANIM_OPTIMIZE_PRECISSION,
ANIM_ACTION_ALL=self.ANIM_ACTION_ALL,
BATCH_ENABLE=self.BATCH_ENABLE,
BATCH_GROUP=self.BATCH_GROUP,
BATCH_FILE_PREFIX=self.BATCH_FILE_PREFIX,
BATCH_OWN_DIR=self.BATCH_OWN_DIR,
)
def menu_func(self, context): def menu_func(self, context):

@ -181,14 +181,12 @@ def getVertsFromGroup(me, group_index):
return ret return ret
# ob must be OB_MESH # ob must be OB_MESH
def BPyMesh_meshWeight2List(ob): def BPyMesh_meshWeight2List(ob, me):
''' Takes a mesh and return its group names and a list of lists, one list per vertex. ''' Takes a mesh and return its group names and a list of lists, one list per vertex.
aligning the each vert list with the group names, each list contains float value for the weight. aligning the each vert list with the group names, each list contains float value for the weight.
These 2 lists can be modified and then used with list2MeshWeight to apply the changes. These 2 lists can be modified and then used with list2MeshWeight to apply the changes.
''' '''
me = ob.data
# Clear the vert group. # Clear the vert group.
groupNames= [g.name for g in ob.vertex_groups] groupNames= [g.name for g in ob.vertex_groups]
len_groupNames= len(groupNames) len_groupNames= len(groupNames)
@ -205,9 +203,9 @@ def BPyMesh_meshWeight2List(ob):
return groupNames, vWeightList return groupNames, vWeightList
def meshNormalizedWeights(me): def meshNormalizedWeights(ob, me):
try: # account for old bad BPyMesh try: # account for old bad BPyMesh
groupNames, vWeightList = BPyMesh_meshWeight2List(me) groupNames, vWeightList = BPyMesh_meshWeight2List(ob, me)
# groupNames, vWeightList = BPyMesh.meshWeight2List(me) # groupNames, vWeightList = BPyMesh.meshWeight2List(me)
except: except:
return [],[] return [],[]
@ -235,7 +233,8 @@ header_comment = \
''' '''
# This func can be called with just the filepath # This func can be called with just the filepath
def save(operator, context, filepath="", \ def save(operator, context, filepath="",
GLOBAL_MATRIX = None,
EXP_OBS_SELECTED = True, EXP_OBS_SELECTED = True,
EXP_MESH = True, EXP_MESH = True,
EXP_MESH_APPLY_MOD = True, EXP_MESH_APPLY_MOD = True,
@ -244,7 +243,6 @@ def save(operator, context, filepath="", \
EXP_CAMERA = True, EXP_CAMERA = True,
EXP_EMPTY = True, EXP_EMPTY = True,
EXP_IMAGE_COPY = False, EXP_IMAGE_COPY = False,
GLOBAL_MATRIX = None,
ANIM_ENABLE = True, ANIM_ENABLE = True,
ANIM_OPTIMIZE = True, ANIM_OPTIMIZE = True,
ANIM_OPTIMIZE_PRECISSION = 6, ANIM_OPTIMIZE_PRECISSION = 6,
@ -2404,8 +2402,7 @@ Objects: {''')
if my_mesh.fbxBoneParent: if my_mesh.fbxBoneParent:
weights = None weights = None
else: else:
weights = meshNormalizedWeights(my_mesh.blenObject) weights = meshNormalizedWeights(my_mesh.blenObject, my_mesh.blenData)
# weights = meshNormalizedWeights(my_mesh.blenData)
#for bonename, bone, obname, bone_mesh, armob in ob_bones: #for bonename, bone, obname, bone_mesh, armob in ob_bones:
for my_bone in ob_bones: for my_bone in ob_bones: