[Bf-extensions-cvs] [f35aff34] master: glTF exporter: Manage tweak mode in NLA when needed

Julien Duroure noreply at git.blender.org
Sat Dec 18 12:04:20 CET 2021


Commit: f35aff344ff651364a54cc6c9fa75bf2699ad2a8
Author: Julien Duroure
Date:   Sat Dec 18 12:03:58 2021 +0100
Branches: master
https://developer.blender.org/rBAf35aff344ff651364a54cc6c9fa75bf2699ad2a8

glTF exporter: Manage tweak mode in NLA when needed

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index a3cc5287..954098eb 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 8, 4),
+    "version": (1, 8, 5),
     'blender': (3, 0, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
index 819c8085..abd498df 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -52,6 +52,10 @@ def gather_animations(blender_object: bpy.types.Object,
                 track.is_solo = False
                 break
 
+    # Remove any tweak mode. Restore after export
+    if blender_object.animation_data:
+        restore_tweak_mode = blender_object.animation_data.use_tweak_mode
+
     # Export all collected actions.
     for blender_action, track_name, on_type in blender_actions:
 
@@ -60,10 +64,7 @@ def gather_animations(blender_object: bpy.types.Object,
             if blender_object.animation_data.action is None \
                     or (blender_object.animation_data.action.name != blender_action.name):
                 if blender_object.animation_data.is_property_readonly('action'):
-                    # NLA stuff: some track are on readonly mode, we can't change action
-                    error = "Action is readonly. Please check NLA editor"
-                    print_console("WARNING", "Animation '{}' could not be exported. Cause: {}".format(blender_action.name, error))
-                    continue
+                    blender_object.animation_data.use_tweak_mode = False
                 try:
                     blender_object.animation_data.action = blender_action
                 except:
@@ -97,7 +98,7 @@ def gather_animations(blender_object: bpy.types.Object,
                 blender_object.animation_data.action = current_action
         if solo_track is not None:
             solo_track.is_solo = True
-
+        blender_object.animation_data.use_tweak_mode = restore_tweak_mode
     return animations, tracks



More information about the Bf-extensions-cvs mailing list