From d7f8d9a4f919894b23ee855d3b1a2327222de468 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Sun, 17 Jan 2021 09:36:51 +0100 Subject: glTF importer: make NLA track order match glTF animation order --- io_scene_gltf2/__init__.py | 2 +- io_scene_gltf2/blender/imp/gltf2_blender_scene.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 -- cgit v1.2.3