[Bf-extensions-cvs] [e5bde5ec] master: glTF exporter: ignore solo mode in NLA, to export all tracks

Julien Duroure noreply at git.blender.org
Tue Mar 17 07:59:01 CET 2020


Commit: e5bde5ec2e6880729896937b65e9097246a558b6
Author: Julien Duroure
Date:   Tue Mar 17 07:58:09 2020 +0100
Branches: master
https://developer.blender.org/rBAe5bde5ec2e6880729896937b65e9097246a558b6

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

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

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 46a8ccda..9dd4f9b8 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, 2, 43),
+    "version": (1, 2, 44),
     'blender': (2, 82, 7),
     '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 05615053..118a112e 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -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



More information about the Bf-extensions-cvs mailing list