feat(skel): SkelAnimQuery + array interp#72
Open
bresilla wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a time-sampled SkelAnimation query API and expands linear interpolation support to array-valued USD types, enabling per-frame animation evaluation and wiring results into existing skinning resolvers.
Changes:
- Introduce
SkelAnimQueryfor sampling joint TRS components, composing joint-local matrices, and sampling blend-shape weights. - Extend
interp::evaluatelinear interpolation to support manyValue::*Vecarray variants (including per-element quat slerp). - Add integration tests validating animation sampling and resolver wiring.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/skel_reader.rs | Adds end-to-end tests covering SkelAnimQuery outputs and integration with SkeletonResolver. |
| src/schemas/skel/mod.rs | Hooks up the new anim_query module, re-exports its public API, and updates skel module docs. |
| src/schemas/skel/anim_query.rs | Implements SkelAnimQuery (sampling, defaults, TRS composition) plus unit tests for matrix helpers. |
| src/interp.rs | Adds linear interpolation support + tests for array (VtArray) Value variants, including quat array slerp and length-mismatch fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+158
to
+168
| Ok(match v { | ||
| Some(Value::Vec3fVec(a)) if a.len() == n => a, | ||
| Some(Value::Vec3dVec(a)) if a.len() == n => { | ||
| a.into_iter().map(|x| [x[0] as f32, x[1] as f32, x[2] as f32]).collect() | ||
| } | ||
| Some(Value::Vec3hVec(a)) if a.len() == n => a | ||
| .into_iter() | ||
| .map(|x| [x[0].to_f32(), x[1].to_f32(), x[2].to_f32()]) | ||
| .collect(), | ||
| _ => vec![default; n], | ||
| }) |
Comment on lines
+28
to
+29
| pub type JointTransformComponents = (Vec<[f32; 3]>, Vec<[f32; 4]>, Vec<[f32; 3]>); | ||
|
|
Comment on lines
+306
to
+310
| // should be a ~22.5° rotation about +Z. | ||
| let w_expected = (std::f32::consts::PI / 8.0).cos(); | ||
| let z_expected = (std::f32::consts::PI / 8.0).sin(); | ||
| assert!((r[1][0] - w_expected).abs() < 1e-3, "w: {}", r[1][0]); | ||
| assert!((r[1][3] - z_expected).abs() < 1e-3, "z: {}", r[1][3]); |
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.
Follow-up to #71. Adds the time-sampled animation evaluator the heads-up there mentioned. With this, the existing skel resolvers can be driven at a stage time.
The query wraps a SkelAnimation prim and exposes translations, rotations, scales, and blend-shape weights at a given time. It delegates to
Stage::value_atso values inherit the stage's interpolation mode, including per-joint slerp on rotations. A separate helper composes the T/R/S triples into per-joint 4×4 matrices ready to feed the SkeletonResolver.For rotations to actually slerp frame to frame, the interp module needed to handle array values. It now covers every VtArray variant in C++'s USD_LINEAR_INTERPOLATION_TYPES — component-wise lerp for vector and matrix arrays, per-element slerp for quaternion arrays. Length mismatches fall back to held, same as C++.
14 unit + 21 integration tests, all green.