Change DirectX (export) animations order?

First of all, let me thank you deeply for the magnificent software and the awesome community. I truly think I’ll stick with Blender for a bit.

I have a question about the exporting order of the animations, - or actions from within Blender - more specifically, I’m working with the DirectX file extension (.x) exporter and I found you can’t really set an order to them. The actions themselves are always alphabetically ordered in the Action Editor pane, but exporting them seems to mess the order up. Usually, it tends to reverse the order of the animations (such as that, for example, actions “1”, “2” & “3” will be written in the file as “_3”, “_2” and “_1”) but it randomly changes for whatever reason. is there really no way to change (or predict, maybe?) the output order of the animations stored in the .x file?

Now, it’s worth mentioning that the “_” (underscore) that gets added to the animation name also seems a bit odd to me, but that really isn’t much of an annoyance really.

If the script used a dict or set, which are unordered by definition, to temporarily store action datablocks, it would explain the rather random order of actions - there is no guarantee about the order of items. It could be changed to use a list or an OrderedDict, which are both ordered.

The prepended underscore is easily removed, I wonder however if it’s a valid name in the .x-format - the underscore might actually be there for a reason.

If you select the option to export an additional null animation, the first anim will always be that one, called “Default_Action”, so I’m assuming no underscore is needed for DirectX to correctly load in the animation. This also never occurs in any other animated .x file I’ve ever used;

However, I have no knowledge of Python whatsoever (the topic was moved but the question was more general than technical) and though I might be able to fix it myself, I doubt editing the script (which is the official DirectX Exporter by the way) on my end would be very beneficial since Blender would eventually get an update… however, if anybody of course went on and told me precisely “duh, you gotta fix line 356 and 602” than I would try it for sure.

I didn’t mean a leading underscore for every action, just in case if the name does not start with a letter (like in many programming langauges, which do no permit digits or special chars as initial character in a variable name).

You can always submit patches to the Blender devs and hope that they include fixes in exporters in master.

Oh yeah, it looks like it’s placing the underscore only before number-starting names. Anyhow, I ended up sorting the names in the loading program, so I think I’ll stick with this method. Still, it would make quite a good update on the script!

Also, if I may report a few more problems with it:

  • Sometimes, the action highlighted in the list while selecting the corresponding skinned mesh (the armature will instead keep the active action highlighted) will be exported empty
  • Sometimes, the “Export Rest Position” will be ignored