glTF exporter: ignore solo mode in NLA, to export all tracks

This commit is contained in:
Julien Duroure 2020-03-17 07:58:09 +01:00
parent b815b9d233
commit e5bde5ec2e
2 changed files with 12 additions and 1 deletions

View File

@ -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, 2, 43),
"version": (1, 2, 44),
'blender': (2, 82, 7),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -43,6 +43,14 @@ def gather_animations(blender_object: bpy.types.Object,
current_action = None
if blender_object.animation_data and blender_object.animation_data.action:
current_action = blender_object.animation_data.action
# Remove any solo (starred) NLA track. Restored after export
solo_track = None
if blender_object.animation_data:
for track in blender_object.animation_data.nla_tracks:
if track.is_solo:
solo_track = track
track.is_solo = False
break
# Export all collected actions.
for blender_action, track_name in blender_actions:
@ -78,6 +86,7 @@ def gather_animations(blender_object: bpy.types.Object,
tracks[track_name].append(offset + len(animations)-1) # Store index of animation in animations
# Restore action status
# TODO: do this in a finally
if blender_object.animation_data:
if blender_object.animation_data.action is not None:
if current_action is None:
@ -86,6 +95,8 @@ def gather_animations(blender_object: bpy.types.Object,
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
if solo_track is not None:
solo_track.is_solo = True
return animations, tracks