Skip to content

Load sublayers authored on anonymous layers - #166

Merged
mxpv merged 2 commits into
mxpv:mainfrom
doubleailes:fix-anon-absolute-sublayer
Oct 23, 2026
Merged

mxpv merged 2 commits into
mxpv:mainfrom
doubleailes:fix-anon-absolute-sublayer

Conversation

@doubleailes

Copy link
Copy Markdown
Contributor

Fixes #165.

Problem

When an anonymous layer had a subLayers entry that wasn't loaded yet,
LayerGraph::file_stack_discoveries dropped the entry before it reached the
stage's load barrier. An absolute-path sublayer authored on an anonymous layer
therefore never opened. That covers both Stage::insert_layer and authoring on
the anonymous root of Stage::builder().in_memory(...). composition_errors()
stayed empty, so the opinions disappeared without any diagnostic.

Fix

This follows C++. An anonymous layer's resolved path is empty, so
SdfComputeAssetPathRelativeToLayer creates the entry's identifier without an
anchor and the layer stack opens it like any other sublayer. A missing asset
reports PcpErrorInvalidSublayerPath.

The skip is removed, so an anonymous parent's unresolved entry now becomes a
load request like any other parent's:

  • An absolute entry opens from disk.
  • A missing asset reports UnresolvedSublayer.
  • An in-memory layer with the literal name still resolves when it joins,
    through the existing bare-name fallback.

References and payloads authored on anonymous layers already went through this
path, so sublayers now behave the same way. The Stage::insert_layer docs
already described this behavior.

There is one behavior change. A relative entry on an anonymous layer that names
no in-memory layer is now also looked up on disk. If it isn't found it reports
UnresolvedSublayer, as C++ does, where before it was silently ignored.

Tests

  • pcp::layer_graph::tests::anon_parent_demands replaces
    anon_parent_no_demand, which asserted the old skip.
  • usd::stage::tests::anon_absolute_sublayer covers cases A and B from the
    issue.
  • usd::stage::tests::anon_missing_sublayer_reports checks that a missing file
    reports UnresolvedSublayer.

All three tests fail without the fix. cargo test --workspace --all-targets --all-features, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo doc and cargo fmt --check pass.

claude and others added 2 commits October 23, 2026 16:28
An anonymous parent's unresolved subLayers entry was dropped before it
reached the load barrier, so an absolute path never opened and nothing
reported it. The entry now files a demand like any other parent's: it
resolves without an anchor, as C++ SdfComputeAssetPathRelativeToLayer
does for an anonymous layer, and a missing asset reports
UnresolvedSublayer.

Fixes mxpv#165.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VvoGc8yq9e7gZnCrKA4qeZ
An anonymous layer's relative asset paths were anchored against its
identifier, anon:<n>:<tag>. A tag with a directory or a .usdz extension
changed what a sublayer, reference or clip path named. These paths
resolve with no anchor, as C++ SdfComputeAssetPathRelativeToLayer does
for an anonymous layer.

With no anchor, DefaultResolver::create_identifier applies the
look-here-first rule against the working directory. A search path
absent from it keeps its bare spelling and resolves through the search
directories.
@mxpv
mxpv force-pushed the fix-anon-absolute-sublayer branch from 477c75c to 33b6414 Compare October 23, 2026 23:40
@mxpv
mxpv merged commit 889878f into mxpv:main Oct 23, 2026
5 checks passed
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.

Absolute-path sublayers of an anonymous layer are never loaded (and no diagnostic is reported)

3 participants