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>2019-05-31 23:18:24 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-05-31 23:18:24 +0300
commita5f2de962763f9c4a037fad0ab2ddf049d73686a (patch)
tree96d6c6db2dc9af15d6240347618f78b800e3ca50 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
parent178738edd2ee2817aaf49bf03b968215795e211c (diff)
glTF exporter: Export multiple actions (from NLA) when sampled is now fixed
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py15
1 files changed, 15 insertions, 0 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 65335534..6473f5de 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -33,12 +33,27 @@ def gather_animations(blender_object: bpy.types.Object, export_settings) -> typi
# Collect all 'actions' affecting this object. There is a direct mapping between blender actions and glTF animations
blender_actions = __get_blender_actions(blender_object)
+ # save the current active action of the object, if any
+ # We will restore it after export
+ current_action = None
+ if blender_object.animation_data and blender_object.animation_data.action:
+ current_action = blender_object.animation_data.action
+
# Export all collected actions.
for blender_action in blender_actions:
+
+ # Set action as active, to be able to bake if needed
+ if blender_object.animation_data: # Not for shapekeys!
+ blender_object.animation_data.action = blender_action
+
animation = __gather_animation(blender_action, blender_object, export_settings)
if animation is not None:
animations.append(animation)
+ # Restore current action
+ if blender_object.animation_data:
+ blender_object.animation_data.action = current_action
+
return animations