feat(media): UsdMedia (SpatialAudio + AssetPreviewsAPI)#96
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 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::mediamodule (SpatialAudio types, reader, authoring, AssetPreviewsAPI helpers) behind themediafeature. - Extends the USDA parser to support
timecodeandtimecode[]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.
| //! [`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. |
| /// Prim metadata `displayName` should be parsed as a string. | ||
| #[test] | ||
| fn parse_timecode_attribute() { |
| /// `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> { |
|
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 :) |
Adds UsdMedia behind a
mediafeature, read + author:assetInfo.previews.thumbnails.default.defaultImagedict.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 accepttimecodeattributes (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 theassetInfothumbnail dict.Hand-authored fixture + in-memory roundtrips.