Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2020-01-08 23:57:32 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-01-08 23:57:32 +0300
commitbad59573c39e07fb2e9e006c60d77ae1151e6103 (patch)
treebcf0069628f2db6c0fb1cde8dcbcf6c8bd2ef5b1 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
parent78e0a5f90786338d2bfd2152c5ec09a4d2a2a974 (diff)
glTF exporter: detach last exported action if no action was active at start of exporting
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py11
1 files changed, 8 insertions, 3 deletions
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