[Bf-extensions-cvs] [3b6028f] master: Fix T44386: FBX export with 'all actions' enabled was a bit too much enthusiast.

Bastien Montagne noreply at git.blender.org
Sun Apr 26 14:50:51 CEST 2015


Commit: 3b6028fd8b895dcc42b23e481fd8d99c10553acd
Author: Bastien Montagne
Date:   Sun Apr 26 14:47:40 2015 +0200
Branches: master
https://developer.blender.org/rBA3b6028fd8b895dcc42b23e481fd8d99c10553acd

Fix T44386: FBX export with 'all actions' enabled was a bit too much enthusiast.

It would export animations from all compatible actions - even for objects that were
actually not animated at all! This would lead to undesired behavior esp. for
simple objects scenes with only one or two animated.

Now we only export all compatible actions for a given object if it is actually
animated.

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

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py

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

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 9b03056..f3865fb 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (3, 2, 3),
+    "version": (3, 2, 4),
     "blender": (2, 74, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, "
@@ -346,7 +346,9 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
             )
     bake_anim_use_all_actions = BoolProperty(
             name="All Actions",
-            description="Export each action as a separated FBX's AnimStack, instead of global scene animation",
+            description="Export each action as a separated FBX's AnimStack, instead of global scene animation "
+                        "(note that animated objects will get all actions compatible with them, "
+                        "others will get no animation at all)",
             default=True,
             )
     bake_anim_step = FloatProperty(
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 95aebbd..e54af83 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -2010,17 +2010,16 @@ def fbx_animations(scene_data):
 
             ob = ob_obj.bdata  # Back to real Blender Object.
 
+            if not ob.animation_data:
+                continue  # Do not export animations for objects that are absolutely not animated, see T44386.
+
             # We can't play with animdata and actions and get back to org state easily.
             # So we have to add a temp copy of the object to the scene, animate it, and remove it... :/
             ob_copy = ob.copy()
             # Great, have to handle bones as well if needed...
             pbones_matrices = [pbo.matrix_basis.copy() for pbo in ob.pose.bones] if ob.type == 'ARMATURE' else ...
 
-            if ob.animation_data:
-                org_act = ob.animation_data.action
-            else:
-                org_act = ...
-                ob.animation_data_create()
+            org_act = ob.animation_data.action
             path_resolve = ob.path_resolve
 
             for act in bpy.data.actions:
@@ -2036,16 +2035,13 @@ def fbx_animations(scene_data):
                 if pbones_matrices is not ...:
                     for pbo, mat in zip(ob.pose.bones, pbones_matrices):
                         pbo.matrix_basis = mat.copy()
-                ob.animation_data.action = None if org_act is ... else org_act
+                ob.animation_data.action = org_act
                 restore_object(ob, ob_copy)
 
             if pbones_matrices is not ...:
                 for pbo, mat in zip(ob.pose.bones, pbones_matrices):
                     pbo.matrix_basis = mat.copy()
-            if org_act is ...:
-                ob.animation_data_clear()
-            else:
-                ob.animation_data.action = org_act
+            ob.animation_data.action = org_act
 
             bpy.data.objects.remove(ob_copy)



More information about the Bf-extensions-cvs mailing list