-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat(stage): track unresolved assets during composition #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #usda 1.0 | ||
| ( | ||
| defaultPrim = "Root" | ||
| ) | ||
|
|
||
| def Xform "Root" | ||
| { | ||
| def "WithMissingRef" ( | ||
| references = @./this_file_does_not_exist.usda@</World> | ||
| ) | ||
| { | ||
| } | ||
|
|
||
| def "WithMissingPayload" ( | ||
| payload = @./also_missing.usda@</Scene> | ||
| ) | ||
| { | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #usda 1.0 | ||
| ( | ||
| defaultPrim = "Root" | ||
| ) | ||
|
|
||
| def Xform "Root" | ||
| { | ||
| def Cube "Cube" | ||
| { | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,8 @@ pub struct Stage { | |||||||||||||||||
| layers: Vec<Box<dyn AbstractData>>, | ||||||||||||||||||
| /// Layer identifiers, parallel to `layers`. | ||||||||||||||||||
| identifiers: Vec<String>, | ||||||||||||||||||
| /// Asset paths that could not be resolved during composition. | ||||||||||||||||||
| unresolved: Vec<String>, | ||||||||||||||||||
| /// Cached prim indices, built lazily per prim. | ||||||||||||||||||
| prim_indices: RefCell<HashMap<Path, PrimIndex>>, | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
@@ -53,7 +55,7 @@ impl Stage { | |||||||||||||||||
| /// Recursively resolves and loads all referenced layers, then builds a | ||||||||||||||||||
| /// composed stage ready for queries. | ||||||||||||||||||
|
Comment on lines
55
to
56
|
||||||||||||||||||
| /// Recursively resolves and loads all referenced layers, then builds a | |
| /// composed stage ready for queries. | |
| /// Recursively resolves and loads referenced layers to build a composed | |
| /// stage ready for queries. | |
| /// | |
| /// If some transitive assets cannot be resolved, this may still return | |
| /// `Ok` with a partially constructed stage; unresolved asset paths are | |
| /// recorded and can be inspected with [`Stage::unresolved_assets`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unresolved.contains(&identifier)is redundant becausevisitedis checked before resolution and the missing-asset branch inserts the identifier intovisitedbefore returning—so you should never reach this branch twice for the same identifier. You can drop thecontainscheck and alwayspush, or (if you also want to protect against future refactors) maintain membership via aHashSet<String>alongside theVec<String>to avoid O(n) scans while preserving encounter order.