[Bf-extensions-cvs] [c7aa80f4] master: glTF exporter: add some NLA checks (readonly action / track)
Julien Duroure
noreply at git.blender.org
Sat Jun 1 19:57:06 CEST 2019
Commit: c7aa80f40ae438618498bc678409a4260f4356ab
Author: Julien Duroure
Date: Sat Jun 1 19:56:28 2019 +0200
Branches: master
https://developer.blender.org/rBAc7aa80f40ae438618498bc678409a4260f4356ab
glTF exporter: add some NLA checks (readonly action / track)
===================================================================
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 0612b547..2e2b6ae2 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": (0, 9, 17),
+ "version": (0, 9, 18),
'blender': (2, 80, 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 6473f5de..7a4f1213 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -44,7 +44,19 @@ def gather_animations(blender_object: bpy.types.Object, export_settings) -> typi
# 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
+ 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
+ try:
+ blender_object.animation_data.action = blender_action
+ except:
+ error = "Action is readonly. Please check NLA editor"
+ print_console("WARNING", "Animation '{}' could not be exported. Cause: {}".format(blender_action.name, error))
+ continue
animation = __gather_animation(blender_action, blender_object, export_settings)
if animation is not None:
@@ -52,7 +64,8 @@ def gather_animations(blender_object: bpy.types.Object, export_settings) -> typi
# Restore current action
if blender_object.animation_data:
- blender_object.animation_data.action = current_action
+ 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
return animations
More information about the Bf-extensions-cvs
mailing list