Preserve unknown gltf mesh extensions in GLTFLoader#25948
Merged
donmccurdy merged 2 commits intomrdoob:devfrom May 5, 2023
Merged
Preserve unknown gltf mesh extensions in GLTFLoader#25948donmccurdy merged 2 commits intomrdoob:devfrom
donmccurdy merged 2 commits intomrdoob:devfrom
Conversation
Previously, only unknown extensions in the gltf's "meshes[].primitives[].extensions" field were added to the populated mesh's userData.gltfExtensions field. It is also valid to add data under "meshes[].extensions" so those should be added to the resulting mesh, too.
Collaborator
|
Thanks @cstegel! When a glTF mesh has multiple primitives, I'm not sure we should be duplicating the extensions across all of the resulting THREE.Mesh instances. How about something like this, later in the affected function? if ( meshes.length === 1 ) {
if ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, meshes[ 0 ], meshDef );
return meshes[ 0 ];
}
const group = new Group();
if ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, group, meshDef );
... |
Contributor
Author
|
@donmccurdy sounds good! I didn't notice that multiple primitives would get put together in their own |
donmccurdy
approved these changes
May 5, 2023
Collaborator
|
Thanks @cstegel! |
CodyJasonBennett
added a commit
to pmndrs/three-stdlib
that referenced
this pull request
May 31, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This is needed for custom glTF extensions which handle extension data under each
meshentry in the glTF json.Previously, only unknown extensions in the glTF json's
meshes[].primitives[].extensionsfield were added to the populated mesh'suserData.gltfExtensionsfield. It is also valid to add data under glTF jsonmeshes[].extensionsso those should be added to the resulting mesh, too.