Skip to content
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

GLTFLoader: assign unique names to children of cloned refs in _getNod… #30091

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Mirei3D
Copy link

@Mirei3D Mirei3D commented Dec 10, 2024

…eRef() (fixes #30090)

Related issue: #30090

Description

When cloning a reference the children of the cloned reference have the same names as the children of the original reference. This causes duplicate names for example when dealing with meshes that have multiple primitives and that are instantiated multiple times.

This pull request attempts to change this by applying the same _instance_X suffix applied to the reference name to its children. Another possible solution might be to apply createUniqueName() on the names of cloned children. Let me know if another solution than the current is preferred and I'd be happy to change it.

@mrdoob mrdoob requested a review from donmccurdy December 11, 2024 05:52
@donmccurdy
Copy link
Collaborator

Changes to the mesh primitive names will be a breaking change for R3F's gltfjsx and Threlte's gltf. We can do that, but to avoid back-to-back breaking changes I think it probably needs to happen at the same time as:

Together I think the two changes will need some pretty careful testing to make sure GLTFLoader is producing a scene graph (structure, names, userDatas) that we are comfortable maintaining.

@Mirei3D
Copy link
Author

Mirei3D commented Dec 12, 2024

Seems reasonable to me to batch these breaking changes together.
On our end we will just implement a work around for now, which updates duplicate names as a post-processing step, and migrate our name references once an official fix is in if needed.

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

Successfully merging this pull request may close these issues.

GLTFLoader: meshes with multiple primitives and multiple instances have non-unique name
2 participants