[Bf-extensions-cvs] [bad59573] master: glTF exporter: detach last exported action if no action was active at start of exporting

Julien Duroure noreply at git.blender.org
Wed Jan 8 21:57:59 CET 2020


Commit: bad59573c39e07fb2e9e006c60d77ae1151e6103
Author: Julien Duroure
Date:   Wed Jan 8 21:57:32 2020 +0100
Branches: master
https://developer.blender.org/rBAbad59573c39e07fb2e9e006c60d77ae1151e6103

glTF exporter: detach last exported action if no action was active at start of exporting

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

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 311a2b46..d8381d0c 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, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 1, 35),
+    "version": (1, 1, 36),
     'blender': (2, 81, 6),
     '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 f959ce14..cf106c41 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -77,10 +77,15 @@ def gather_animations(blender_object: bpy.types.Object,
                         tracks[track_name] = []
                     tracks[track_name].append(offset + len(animations)-1) # Store index of animation in animations
 
-    # Restore current action
+    # Restore action status
     if blender_object.animation_data:
-        if blender_object.animation_data.action is not None and current_action is not None and blender_object.animation_data.action.name != current_action.name:
-            blender_object.animation_data.action = current_action
+        if blender_object.animation_data.action is not None:
+            if current_action is None:
+                # remove last exported action
+                blender_object.animation_data.action = None
+            elif blender_object.animation_data.action.name != current_action.name:
+                # Restore action that was active at start of exporting
+                blender_object.animation_data.action = current_action
 
     return animations, tracks



More information about the Bf-extensions-cvs mailing list