[Bf-extensions-cvs] [c4a7943] master: Fix T48631: FBX setting "bake_anim_use_nla_strips": True, fails to export unique animations to each take.

Bastien Montagne noreply at git.blender.org
Fri Jun 10 15:55:45 CEST 2016


Commit: c4a79435e45610d50dadfacf2ed2c09ce595f70f
Author: Bastien Montagne
Date:   Fri Jun 10 15:54:49 2016 +0200
Branches: master
https://developer.blender.org/rBAc4a79435e45610d50dadfacf2ed2c09ce595f70f

Fix T48631: FBX setting "bake_anim_use_nla_strips": True, fails to export unique animations to each take.

Active action of object's animdata would override actual NLA's strip animation...

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

M	io_scene_fbx/export_fbx_bin.py

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

diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 98cc265..831426d 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1992,6 +1992,7 @@ def fbx_animations(scene_data):
     # Per-NLA strip animstacks.
     if scene_data.settings.bake_anim_use_nla_strips:
         strips = []
+        ob_actions = []
         for ob_obj in scene_data.objects:
             # NLA tracks only for objects, not bones!
             if not ob_obj.is_object:
@@ -1999,6 +2000,9 @@ def fbx_animations(scene_data):
             ob = ob_obj.bdata  # Back to real Blender Object.
             if not ob.animation_data:
                 continue
+            # We have to remove active action from objects, it overwrites strips actions otherwise...
+            ob_actions.append((ob, ob.animation_data.action))
+            ob.animation_data.action = None
             for track in ob.animation_data.nla_tracks:
                 if track.mute:
                     continue
@@ -2017,6 +2021,9 @@ def fbx_animations(scene_data):
         for strip in strips:
             strip.mute = False
 
+        for ob, ob_act in ob_actions:
+            ob.animation_data.action = ob_act
+
     # All actions.
     if scene_data.settings.bake_anim_use_all_actions:
         def validate_actions(act, path_resolve):



More information about the Bf-extensions-cvs mailing list