Skip to content

GLTF: Make skeleton bone names unique per-skeleton instead of scene-wide #106537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented May 17, 2025

Fixes #106073, fixes #93758, fixes #96248. This restores the behavior in Godot 4.2 and earlier.

This PR makes the unique name feature no longer apply cross-skeleton. Skeleton bones now need to be unique within the same skeleton and compared to scene nodes, but not compared to all skeletons in the scene node.

This only affects glTF files with multiple skeletons in it, which is a niche use case, so this is low-risk. Users of this feature expect to be able to use the same bone map for each skeleton for animation targeting.

Note: This PR makes it possible to generate multiple nodes with the same name in the case of BoneAttachment3D nodes, since they are given the same name as the bone they are attached to. I think this is fine, and the alternatives are worse.

Note: This PR does not affect export. A comment introduced in PR #53114 indicates the current export behavior of having all glTF nodes including bones be unique was intentional. We could change the export behavior too, though.

Note: This PR adds a duplicate() function to HashSet, because I needed to duplicate a HashSet.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not review the code.

Approve of the feature.

Copy link
Contributor

@lyuma lyuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good for glTF

@aaronfranke aaronfranke force-pushed the gltf-per-skel-unique branch from 850a5be to 8350919 Compare June 10, 2025 09:46
@akien-mga akien-mga merged commit 3925ca0 into godotengine:master Jun 10, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@aaronfranke aaronfranke deleted the gltf-per-skel-unique branch June 10, 2025 16:48
@dmlary
Copy link
Contributor

dmlary commented Jun 22, 2025

EDIT: There's a config option at the bottom of the import settings under glTF, called Naming Version. It needs to be set to "Godot 4.5 or later". I think it preserved the 4.3-4.4 naming when I opened an old project.

This works great, thank you so much!

I was looking for this fix on 4.5-beta1. It looks like it is present for GLTF import, but bones are still renamed when imported directly from .blender files. Does the blender import path leveraged GLTF behind the scenes? Is there any way we can get this fix in for .blender files too by the 4.5 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants