Fix NullReferenceException for morph target accessors without BufferView#900
Draft
SmittyWerbenJJ wants to merge 2 commits intoKhronosGroup:mainfrom
Draft
Fix NullReferenceException for morph target accessors without BufferView#900SmittyWerbenJJ wants to merge 2 commits intoKhronosGroup:mainfrom
SmittyWerbenJJ wants to merge 2 commits intoKhronosGroup:mainfrom
Conversation
|
|
I forgot to upload the right version ... Actually checking for null BufferView
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.
Importing a glTF file with morph targets exported from Blender (confirmed also
reproducible with files exported from Godot) throws a
NullReferenceException:The crash is on this line in
ConstructMeshTargetsPrepareBuffers:Root Cause
The glTF 2.0 spec explicitly defines
accessor.bufferViewas optional.Section 5.1.1 of the glTF 2.0 spec (
accessor.bufferView):Section 3.6.2.3 (Sparse Accessors) reinforces this:
This means
bufferViewANDsparsecan both legally be null simultaneously. It simply means the accessor is all zeros.For morph targets specifically, Section 3.7.2.2 explicitly calls this out as an intended authoring pattern (emphasis mine):
The existing code already handles the null
bufferViewcase in thesparse != nullbranch (added for Draco support), but the
sparse == nullbranch was missing thesame guard and assumed
bufferViewwould always be present.Fix
Added a null-check to the non-sparse branch, mirroring the existing Draco guard