Skip to content

feat(interp): stage-level time-sample evaluator#71

Merged
mxpv merged 1 commit into
mxpv:mainfrom
bresilla:feat/interp
May 25, 2026
Merged

feat(interp): stage-level time-sample evaluator#71
mxpv merged 1 commit into
mxpv:mainfrom
bresilla:feat/interp

Conversation

@bresilla
Copy link
Copy Markdown
Contributor

USD attributes can carry timeSamples but the crate has had no evaluator for them so far. Anyone wanting a value at a specific stage time had to read the raw samples and interpolate by hand. This PR adds the evaluator so consumers can just ask.

src/
├── interp.rs       # InterpolationType + evaluate()
└── stage.rs        # value_at(), getter/setter, builder method
tests/
└── interp.rs

fixtures/
└── interp_scene.usda

Stage::value_at(attr, time) matches C++ UsdAttribute::Get(time). It reads timeSamples, picks the bracketing pair, interpolates per the stage's mode, or returns the attribute's default when there are no samples.

The behaviour follows AOUSD §12.5:

  • Linear is the default mode.
  • Quaternions interpolate via slerp (lerp would take the wrong arc).
  • Types not listed in §12.5.2 fall back to held.
  • A ValueBlock in the bracketing pair returns None.
  • Before the first sample and after the last, the value is clamped.

11 unit + 11 integration tests, all green. ROADMAP §12.5.1 and §12.5.2 flip to ✅.

Heads-up: a follow-up PR will add UsdSkelAnimQuery on top of this — a thin wrapper that pulls a SkelAnimation's translations / rotations / scales through value_at so the existing SkeletonResolver / SkinningResolver can be driven at a stage time.

Copilot AI review requested due to automatic review settings May 25, 2026 02:23
@mxpv
Copy link
Copy Markdown
Owner

mxpv commented May 25, 2026

Nice!

@mxpv mxpv merged commit de7c8a4 into mxpv:main May 25, 2026
5 checks passed
@bresilla bresilla deleted the feat/interp branch May 25, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants