[Bf-extensions-cvs] [34998c8] master: Fix T42029: FBX export: armatures linked to mesh only through modifier were not exported correctly.

Bastien Montagne noreply at git.blender.org
Wed Oct 1 09:00:24 CEST 2014


Commit: 34998c87c0baf8c502c34ff5526d72c57f8821a9
Author: Bastien Montagne
Date:   Wed Oct 1 08:56:09 2014 +0200
Branches: master
https://developer.blender.org/rBA34998c87c0baf8c502c34ff5526d72c57f8821a9

Fix T42029: FBX export: armatures linked to mesh only through modifier were not exported correctly.

Now also check modifiers stack.

===================================================================

M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/fbx_utils.py
M	io_scene_fbx_experimental/export_fbx_bin.py
M	io_scene_fbx_experimental/fbx_utils.py

===================================================================

diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 6025441..0171325 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1676,7 +1676,7 @@ def fbx_skeleton_from_armature(scene, settings, arm_obj, objects, data_meshes,
     data_bones.update((bo, get_blender_bone_key(arm_obj.bdata, bo.bdata)) for bo in bones)
 
     for ob_obj in objects:
-        if not (ob_obj.is_object and ob_obj.type == 'MESH' and ob_obj.parent == arm_obj):
+        if not ob_obj.is_deformed_by_armature(arm_obj):
             continue
 
         # Always handled by an Armature modifier...
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 8e632ea..df215f9 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -1054,6 +1054,15 @@ class ObjectWrapper(metaclass=MetaObjectWrapper):
         return ()
     material_slots = property(get_material_slots)
 
+    def is_deformed_by_armature(self, arm_obj):
+        if not (self.is_object and self.type == 'MESH'):
+            return False
+        if self.parent == arm_obj:
+            return True
+        for mod in self.bdata.modifiers:
+            if mod.type == 'ARMATURE' and mod.object == arm_obj.bdata:
+                return True
+
     # #### Duplis...
     def dupli_list_create(self, scene, settings='PREVIEW'):
         if self._tag == 'OB':
diff --git a/io_scene_fbx_experimental/export_fbx_bin.py b/io_scene_fbx_experimental/export_fbx_bin.py
index 63fcdb1..f3a7dd5 100644
--- a/io_scene_fbx_experimental/export_fbx_bin.py
+++ b/io_scene_fbx_experimental/export_fbx_bin.py
@@ -1683,7 +1683,7 @@ def fbx_skeleton_from_armature(scene, settings, arm_obj, objects, data_meshes,
     data_bones.update((bo, get_blender_bone_key(arm_obj.bdata, bo.bdata)) for bo in bones)
 
     for ob_obj in objects:
-        if not (ob_obj.is_object and ob_obj.type == 'MESH' and ob_obj.parent == arm_obj):
+        if not ob_obj.is_deformed_by_armature(arm_obj):
             continue
 
         # Always handled by an Armature modifier...
diff --git a/io_scene_fbx_experimental/fbx_utils.py b/io_scene_fbx_experimental/fbx_utils.py
index 4ed4292..a15b1e1 100644
--- a/io_scene_fbx_experimental/fbx_utils.py
+++ b/io_scene_fbx_experimental/fbx_utils.py
@@ -1057,6 +1057,15 @@ class ObjectWrapper(metaclass=MetaObjectWrapper):
         return ()
     material_slots = property(get_material_slots)
 
+    def is_deformed_by_armature(self, arm_obj):
+        if not (self.is_object and self.type == 'MESH'):
+            return False
+        if self.parent == arm_obj:
+            return True
+        for mod in self.bdata.modifiers:
+            if mod.type == 'ARMATURE' and mod.object == arm_obj.bdata:
+                return True
+
     # #### Duplis...
     def dupli_list_create(self, scene, settings='PREVIEW'):
         if self._tag == 'OB':



More information about the Bf-extensions-cvs mailing list