fix: skip unsupported mesh attributes instead of throwing#80
Open
nixoletas wants to merge 1 commit intomagicien:masterfrom
Open
fix: skip unsupported mesh attributes instead of throwing#80nixoletas wants to merge 1 commit intomagicien:masterfrom
nixoletas wants to merge 1 commit intomagicien:masterfrom
Conversation
GLB files exported from tools like Sketchfab may contain more than 4 texture coordinate sets (e.g. TEXCOORD_4). Since SceneKit only supports a limited set of vertex attribute semantics, these extra attributes should be gracefully skipped rather than causing the entire mesh load to fail with a NotSupported error. This fixes the "unable to load renderable" error when loading standard glTF 2.0 files that happen to include attributes not mapped in attributeMap (such as TEXCOORD_4+, custom attributes, etc.). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
TEXCOORD_4+, custom attributes) gracefully instead of throwingGLTFUnarchiveError.NotSupportedProblem
GLB files exported from tools like Sketchfab may include more than 4 texture coordinate sets (
TEXCOORD_0throughTEXCOORD_4). TheattributeMapinGLTFTypes.swiftonly maps up toTEXCOORD_3, so whenloadAttributes()encountersTEXCOORD_4, it throws:Since SceneKit only uses 2 UV sets anyway, these extra attributes can be safely ignored.
Fix
Changed
loadAttributes()inGLTFUnarchiver.swifttocontinue(with a debug print) instead ofthrowwhen encountering unmapped attributes. This matches how other glTF loaders handle unsupported attributes — they skip gracefully rather than failing the entire mesh.Also fixed the same pattern in the commented-out legacy code block for consistency.
Test plan
TEXCOORD_4attribute🤖 Generated with Claude Code