blender-to-gmstudio / blender-to-smf

Import-Export of Blender model from/to SMF model format
MIT License
11 stars 2 forks source link

Guarantee a consistent order of animations #50

Closed bartteunis closed 1 year ago

bartteunis commented 1 year ago

Currently a Python set is used to store the unique animations (actions), which is then iterated through. Because items in sets don't have an order, there is no guaranteed order on exporting.

Come up with a proper fix for this.

bartteunis commented 1 year ago

There is the OrderedDict collection that guarantees that items are traversed in the order they're first added. Starting from Python 3.7, this also appears to be guaranteed by the regular dict class, as mentioned on the page:

now that the built-in dict class gained the ability to remember insertion order (this new behavior became guaranteed in Python 3.7).

As the minimum version of the add-on is set to 2.80, and 2.80 appears to be bundled with Python 3.7, switching from set to dict should be fine. Change it like this and verify if this works correctly.