Support /nodes/{}/weights/{}
#1
Open
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
In KHR_animation_pointer, it can control individual morph weights via the path
/nodes/{}/weights/{}. It allows us to have a simpler animation definition to control a single morph target without having an animation buffer that controls all associated weights, which is often bloated with a load of zeros.See: https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc#4-core-pointers
This PR adds support for
/nodes/{}/weights/{}to the library.This should support meshes with and without multi-materials (primitives).
Why I'm doing this
I'm currently working on the KHR_character specification, which depends on
KHR_animation_pointer.Our spec includes functionality to control characters' facial expressions through animations, which works nicely with
/nodes/{}/weights/{}.Test model
I have made a test model that contains a mesh with two morph targets and two animations that use
/nodes/{}/weights/{}.Note that the model does not contain multi-material meshes.
KHRAnimationPointerIndividualWeights.zip
Points need review
It is my first time contributing to this codebase, though I believe the diff is concise enough.
I assume you'll improve the parser implementation later, so I didn't make unnecessarily big changes to logic branches here.
If I'm doing anything wrong, please let me know.
Possible Workaround without this PR
Create animations without
/nodes/{}/weights/{}.