[Bf-extensions-cvs] [162cba01] blender-v3.0-release: Fix T93209: FBX export error if there is an action in NLA tweakmode

Philipp Oeser noreply at git.blender.org
Mon Nov 22 14:15:04 CET 2021


Commit: 162cba016c8c11bcebea4d8d3cf80da9faf4ce76
Author: Philipp Oeser
Date:   Fri Nov 19 12:19:51 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rBA162cba016c8c11bcebea4d8d3cf80da9faf4ce76

Fix T93209: FBX export error if there is an action in NLA tweakmode

Code tried to set the action to None, but in this case, the action is
read-only.

If we find such a case, now set tweakmode to False temporarily and
restore after actions have been processed.

Maniphest Tasks: T93209

Differential Revision: https://developer.blender.org/D13286

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

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 07a7b62d..5a2b7997 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": (4, 26, 0),
+    "version": (4, 27, 0),
     "blender": (2, 90, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 09dfaa9f..e3c86d52 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -2091,8 +2091,14 @@ def fbx_animations(scene_data):
             ob = ob_obj.bdata  # Back to real Blender Object.
             if not ob.animation_data:
                 continue
+
+            # Some actions are read-only, one cause is being in NLA tweakmode
+            restore_use_tweak_mode = ob.animation_data.use_tweak_mode
+            if ob.animation_data.is_property_readonly('action'):
+              ob.animation_data.use_tweak_mode = False
+
             # We have to remove active action from objects, it overwrites strips actions otherwise...
-            ob_actions.append((ob, ob.animation_data.action))
+            ob_actions.append((ob, ob.animation_data.action, restore_use_tweak_mode))
             ob.animation_data.action = None
             for track in ob.animation_data.nla_tracks:
                 if track.mute:
@@ -2113,8 +2119,9 @@ def fbx_animations(scene_data):
         for strip in strips:
             strip.mute = False
 
-        for ob, ob_act in ob_actions:
+        for ob, ob_act, restore_use_tweak_mode in ob_actions:
             ob.animation_data.action = ob_act
+            ob.animation_data.use_tweak_mode = restore_use_tweak_mode
 
     # All actions.
     if scene_data.settings.bake_anim_use_all_actions:



More information about the Bf-extensions-cvs mailing list