From 3b6028fd8b895dcc42b23e481fd8d99c10553acd Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 26 Apr 2015 14:47:40 +0200 Subject: 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. --- io_scene_fbx/__init__.py | 6 ++++-- io_scene_fbx/export_fbx_bin.py | 16 ++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 9b030569..f3865fb4 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 95aebbd8..e54af834 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) -- cgit v1.2.3