[Bf-extensions-cvs] [5f1ad507] master: glTF exporter: alphabetically sorting of exported animation

Julien Duroure noreply at git.blender.org
Tue Dec 3 06:53:25 CET 2019


Commit: 5f1ad50707e7aa640ffcef93c90c9997c99d5c50
Author: Julien Duroure
Date:   Tue Dec 3 06:52:37 2019 +0100
Branches: master
https://developer.blender.org/rBA5f1ad50707e7aa640ffcef93c90c9997c99d5c50

glTF exporter: alphabetically sorting of exported animation

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

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 45a09fa2..9a381211 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, 1, 19),
+    "version": (1, 1, 20),
     'blender': (2, 81, 6),
     '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 d55c20b1..a2e903e5 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -231,6 +231,8 @@ def __get_blender_actions(blender_object: bpy.types.Object,
 
     # Remove duplicate actions.
     blender_actions = list(set(blender_actions))
+    # sort animations alphabetically (case insensitive) so they have a defined order and match Blender's Action list
+    blender_actions.sort(key = lambda a: a.name.lower())
 
     return [(blender_action, blender_tracks[blender_action.name]) for blender_action in blender_actions]



More information about the Bf-extensions-cvs mailing list