Skip to content

feat(media): UsdMedia (SpatialAudio + AssetPreviewsAPI)#96

Open
bresilla wants to merge 6 commits into
mxpv:mainfrom
bresilla:feat/media
Open

feat(media): UsdMedia (SpatialAudio + AssetPreviewsAPI)#96
bresilla wants to merge 6 commits into
mxpv:mainfrom
bresilla:feat/media

Conversation

@bresilla
Copy link
Copy Markdown
Contributor

@bresilla bresilla commented Jun 1, 2026

Adds UsdMedia behind a media feature, read + author:

  • SpatialAudio - filePath / auralMode / playbackMode / startTime / endTime / mediaOffset / gain, with decoded enums and spec-correct defaults. Inherits Xformable, so transform/visibility/purpose come from the UsdGeom layer.
  • AssetPreviewsAPI - default thumbnail via the assetInfo.previews.thumbnails.default.defaultImage dict.

Two small enabling pieces land as their own commits so they can be cherry-picked independently:

  • feat(usda): timecode attribute type - the parser didn't accept timecode attributes (only built-in numeric/string types); SpatialAudio's startTime/endTime need it.
  • feat(usd): Prim::set_metadata - prim-level metadata authoring (mirrors C++ UsdObject::SetMetadata), needed to author the assetInfo thumbnail dict.

Hand-authored fixture + in-memory roundtrips.

Copilot AI review requested due to automatic review settings June 1, 2026 11:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds initial UsdMedia schema support behind a new media feature, including reading/authoring for SpatialAudio and thumbnail previews, plus parser support for timecode and accompanying tests/fixtures.

Changes:

  • Introduces schemas::media module (SpatialAudio types, reader, authoring, AssetPreviewsAPI helpers) behind the media feature.
  • Extends the USDA parser to support timecode and timecode[] values.
  • Adds unit/integration tests and a USDA fixture to validate media reading/authoring behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/media_reader.rs New integration test validating media readers against a USDA fixture.
src/usda/parser.rs Adds timecode parsing support and a unit test for round-tripping.
src/usd/prim.rs Adds a prim-level set_metadata authoring helper and a unit test.
src/schemas/mod.rs Wires up the new media schema module behind a feature gate.
src/schemas/media/types.rs Adds decoded enums + read struct for SpatialAudio.
src/schemas/media/tokens.rs Adds centralized token constants for UsdMedia.
src/schemas/media/read.rs Implements SpatialAudio attribute reader with spec defaults.
src/schemas/media/previews.rs Implements AssetPreviewsAPI thumbnail read/write via assetInfo.
src/schemas/media/mod.rs Exposes UsdMedia public API and adds module-level tests/docs.
src/schemas/media/author.rs Implements authoring helpers for SpatialAudio prim attributes.
fixtures/usdMedia_scene.usda Adds fixture scene used by integration tests.
ROADMAP.md Marks UsdMedia as implemented on main and summarizes coverage.
Cargo.toml Adds the media feature and a feature-gated integration test target.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/schemas/media/mod.rs
Comment on lines +11 to +14
//! [`ReadSpatialAudio`]'s `Default` matches Pixar's `usdMedia/schema.usda`
//! fallbacks (`auralMode = spatial`, `playbackMode = onceImageVisible`,
//! `gain = 1.0`), so callers can `unwrap_or_default()` for a spec-correct
//! fallback.
Comment thread src/usda/parser.rs Outdated
Comment on lines +3118 to +3120
/// Prim metadata `displayName` should be parsed as a string.
#[test]
fn parse_timecode_attribute() {
Comment thread src/usd/prim.rs
/// `key` is `&'static str` so the change-tracking layer can record it
/// without copying; pass a `pub const FOO: &str = "..."` token rather than
/// a runtime-built string.
pub fn set_metadata(self, key: &'static str, value: impl Into<sdf::Value>) -> Result<Self, StageAuthoringError> {
@mxpv
Copy link
Copy Markdown
Owner

mxpv commented Jun 2, 2026

Looks like all schema PRs will conflict once one of them gets merged.

@bresilla
Copy link
Copy Markdown
Contributor Author

bresilla commented Jun 2, 2026

Looks like all schema PRs will conflict once one of them gets merged.

Hi @mxpv, yeahh i expected that, sorry for this. I'll resolve all the conflicts later today :)

Those 4 PR's are the last things directly ported form my upstream project :)

From now on, i will contribute on the gaps that remain in the ROADMAP.md, i will not send you large PR's - but smaller ones so you can review easier :)

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.

3 participants