[Bf-extensions-cvs] [d7f8d9a4] blender-v2.92-release: glTF importer: make NLA track order match glTF animation order

Julien Duroure noreply at git.blender.org
Sun Jan 17 09:37:11 CET 2021


Commit: d7f8d9a4f919894b23ee855d3b1a2327222de468
Author: Julien Duroure
Date:   Sun Jan 17 09:36:51 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rBAd7f8d9a4f919894b23ee855d3b1a2327222de468

glTF importer: make NLA track order match glTF animation order

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/imp/gltf2_blender_scene.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 5cde29d2..27a9e61e 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, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 5, 13),
+    "version": (1, 5, 14),
     'blender': (2, 91, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
index e6eadcd6..1a276960 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
@@ -50,7 +50,9 @@ class BlenderScene():
     def create_animations(gltf):
         """Create animations."""
         if gltf.data.animations:
-            for anim_idx, _anim in enumerate(gltf.data.animations):
+            # NLA tracks are added bottom to top, so create animations in
+            # reverse so the first winds up on top
+            for anim_idx in reversed(range(len(gltf.data.animations))):
                 BlenderAnimation.anim(gltf, anim_idx)
 
             # Restore first animation



More information about the Bf-extensions-cvs mailing list