Godot version:
3.1-beta4
OS/device including version:
ArchLinux rolling
Issue description:
Godot should have option to force sorting of bones when importing COLLADA model to make bone indexes deterministic. We're currently having a nightmare adding rigged cosmetic items to our characters because the bone order is different all the time.
Consider this skeleton:
If L_Thigh and R_Thigh XML blocks are swapped in DAE (happens for some reason; thanks 3DS Max), then their indexes will change during import into Godot. This makes imported mesh no longer compatible with the same base skeleton that was imported from a different DAE file.
Godot should have ability to force bone sorting by their names to preserve their indexes. I consider this a bug in Godot because DAE itself uses string identifiers internally. Thus DAE is not prone to errors when bone order is different, but Godot DAE importer degrades string identifiers into integer indexes.
Steps to reproduce:
After collada is converted to the in memory representation and before the internal format, the resulting list should be sorted and then the order of adding wouldn't change.
That sounds doable.
Busy, but the idea is to sort the skeleton_bone_map after they're populated.
Map
Right! _populate_skeleton is called recursively in its last lines, so we could sort p_node->children before iteration.
That would be sufficient for skeleton matching (as long as bone hierarchy remains the same.)
You would not sort it, but use a array of nodes that have been sorted.
Can anyone still reproduce this bug in Godot 3.2.1 or any later release (e.g. 3.2.2-rc2)?
If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.