Skip to content

fix(usda): tolerate unknown prim metadata fields#95

Merged
mxpv merged 1 commit into
mxpv:mainfrom
bresilla:feat/usda-tolerate-metadata
Jun 1, 2026
Merged

fix(usda): tolerate unknown prim metadata fields#95
mxpv merged 1 commit into
mxpv:mainfrom
bresilla:feat/usda-tolerate-metadata

Conversation

@bresilla
Copy link
Copy Markdown
Contributor

@bresilla bresilla commented Jun 1, 2026

The USDA parser rejected any prim-metadata field it didn't recognize, but Sdf accepts arbitrary identifier-keyed fields in the ( … ) block and preserves the unrecognized ones. So real-world layers (Omniverse authors hide_in_stage_window, no_delete; DCCs add their own) fail to parse.

Now unknown prim metadata is parsed and stashed on the spec instead of erroring - known fields are unchanged. Lets these layers load through Stage::open without a pre-strip pass.

Copilot AI review requested due to automatic review settings June 1, 2026 00:13
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.

Relaxes USDA parsing to tolerate unknown prim metadata keys (e.g., DCC/Omniverse hints like hide_in_stage_window, no_delete) instead of failing the parse, storing them on the spec to match Pixar's behavior of preserving unrecognized metadata.

Changes:

  • Replace bail! on unknown prim metadata identifiers with a fallback that parses the value and adds it to the spec (rejecting only listOp-qualified unknown fields).
  • Add a regression test (parse_tolerates_unknown_prim_metadata) covering bool-like tokens, strings, and ints under several non-standard identifiers.

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

Comment thread src/usda/parser.rs
Comment on lines +1035 to +1044
other => {
ensure!(
list_op.is_none(),
"list ops are not supported for unknown prim metadata: {other}"
);
let value = self
.parse_property_metadata_value()
.with_context(|| format!("Unable to parse prim metadata value for {other}"))?;
spec.add(other, value);
}
Comment thread src/usda/parser.rs
Comment on lines +1040 to +1041
let value = self
.parse_property_metadata_value()
Comment thread src/usda/parser.rs
Comment on lines +3166 to +3170
assert_eq!(
spec.get("hide_in_stage_window"),
Some(&sdf::Value::Token("false".into()))
);
assert_eq!(spec.get("no_delete"), Some(&sdf::Value::Token("true".into())));
@mxpv mxpv merged commit d98fbc5 into mxpv:main Jun 1, 2026
6 checks passed
@bresilla bresilla deleted the feat/usda-tolerate-metadata branch June 4, 2026 11:26
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