gltf: Fix validation errors due to chunk padding and empty skins. #54249
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.
Related to #51132
GLB chunk padding length calculation was backwards: The old code did % 4 which would give 1 byte of padding for a 1 byte chunk, and 3 bytes of padding for a 3 byte chunk.
Additionally, Godot was not adding any padding for the BIN chunk (nul bytes according to the spec),
See the relevant section of spec here: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#structured-json-content
Also fixed error caused by "skins":[] when no skins were present.
Validation errors fixed by this change:
Added a change to fix #54251 by encoding animations before textures.
Bugsquad edit: Fixes #51132, fixes #54251.