Skip to content

Complete UsdShade NodeDef source queries - #134

Merged
mxpv merged 1 commit into
mxpv:mainfrom
NicTanghe:pr_nodedefQueries
Aug 13, 2026
Merged

Complete UsdShade NodeDef source queries#134
mxpv merged 1 commit into
mxpv:mainfrom
NicTanghe:pr_nodedefQueries

Conversation

@NicTanghe

Copy link
Copy Markdown
Contributor

The existing UsdShade layer exposed universal NodeDef attributes but left callers
to interpret info:implementationSource, construct source-type-specific property
names, and apply fallback rules themselves. That made it possible to inspect the
raw scene description, but not to reliably determine which shader
implementation was active or obtain the definition metadata needed by a
material-network consumer.

What it does

Adds the composed NodeDef query surface needed to identify shader
implementations without rebuilding OpenUSD selection rules downstream:

  • Resolves the active info:implementationSource, falling back to identifier
    mode when the value is unauthored, mistyped, or unrecognized.

  • Returns info:id only while identifier mode is active; the raw id_attr
    accessor remains available for generic USD inspection.

  • Queries universal and source-type-specific source assets, asset
    sub-identifiers, and inline source code.

  • Falls back to the universal property only when the requested
    source-type-specific property is not defined. A defined but valueless
    property remains authoritative.

  • Discovers source types from properties belonging to the active
    implementation family while preserving composed property order.

  • Returns source assets as composed sdf::AssetPath values, retaining their
    authored, evaluated, and resolved paths.

  • Adds the public SdrMetadata map and composed whole-map, keyed, and presence
    queries for shaders, inputs, and outputs.

  • Shares NodeDef selection through private prim-based helpers so a future
    NodeDefAPI view can reuse the behavior.

  • Updates the UsdShade documentation, roadmap, unit tests, and integration
    coverage, including resolved source assets and layered metadata composition.

The query layer preserves the distinction between valid string-valued
sdrMetadata entries and malformed values: map and keyed-value queries omit
invalid entries, while presence queries still report their authored keys.


This stops at structural NodeDef discovery. It does not add an SdrRegistry,
shader-parser plugins, shader dialect parsing, or shader compilation. A
separate Sdr-compatible layer can consume these results to provide node
signatures and fallback values, while renderer integrations remain responsible
for lowering supported definitions into executable shaders.

Shader implementation data previously exposed only raw universal attributes, leaving callers to
    interpret implementationSource and construct source-type-specific property names themselves. The composed
    queries now select the active identifier, source-asset, or source-code family and fall back to identifier
    mode for unauthored or invalid selectors.

Source assets, asset sub-identifiers, and inline source code support source-type-specific lookup with
    universal fallback. Source-type discovery follows the active implementation family, defined properties
    correctly block fallback, and asset results retain their authored, evaluated, and resolved paths.

Shader, Input, and Output expose composed sdrMetadata maps, keyed lookups, and presence queries. Focused
    and integration tests cover selection, fallback, metadata composition, malformed data, and resolved source
    assets, with the UsdShade documentation and roadmap updated for the completed query surface.
@mxpv
mxpv merged commit e10cd18 into mxpv:main Aug 13, 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.

2 participants