fix: Assimp skeleton/animation importer for models with duplicate node names #2444
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Details
See model in #2406 (be aware the second animation seems to play strangely, but this is consistent with how it plays in Blender 3.6 - it didn't import properly in a higher version of Blender)
Assimp has a generic 'Node' hierarchy structure and a 'Bone' list (per mesh).
Each Bone has a corresponding 'Node', however the link between the two is only done by name.
Unfortunately, this is a problem when a model has duplicate names, eg. the model's armature and bone, and Stride will more than likely link the 'Bone' to the non-Bone node.
This fix attempts to make an educated guess whenever duplicated names occurs.
If it fails to properly detect what should be linked, then it'll output a warning/error telling the end-user to make the name unique.
While
aiPostProcessSteps.aiProcess_PopulateArmatureData
does exist on the importer which is supposed to link the bone to the node, it does not make any effort to correctly link a bone to the bone node if duplicate names exist (it just searches for the first matching name), so this is not used.Related Issue
This is a fundamental flaw in Assimp, assimp/assimp#4064 may help if it gets resolved.
Fixes #2406
Types of changes
Checklist