Skip to main content

Crate openusd_build

Crate openusd_build 

Source
Expand description

Generates Rust schema views from OpenUSD schema.usda files, with the metadata fields and kinds a plugInfo.json declares beside them.

This is the Rust answer to usdGenSchema, shaped as a build dependency: a consumer describes its schema libraries in build.rs, and the generated views join the crate through openusd::include_schema!.

// build.rs
openusd_build::configure()
    .search_path("schemas")
    .schema("schemas/usdGeom/schema.usda")
    .generate()?;
ⓘ
// src/lib.rs
pub mod geom {
    openusd::include_schema!("usdGeom");
}

A library’s name comes from the libraryName its schema.usda declares, not from the path, so the two spellings above name one library.

Builder::plug_info adds what a library’s plugin declares, and Builder::declaration_family generates a plugin that has declarations and no schema.usda at all.

Builder::generate reads and checks the schemas it is given and writes one file per library, carrying both the views and the schema data behind them. The data is written as declarations a registry takes directly, so nothing is serialized on the way out and nothing is parsed on the way back in: what a consumer registers is a const its compiler has already checked.

A registry is handed the whole of it through the SCHEMAS each generated library exposes:

ⓘ
use openusd::usd::SchemaRegistry;

let registry = SchemaRegistry::builder().register(geom::SCHEMAS).build()?;

Fenced ignore, as the include_schema! example above is: this crate has no build script, so there is no OUT_DIR here for the module to come from.

Structs§

Builder
What to generate, and where.
NodeOutput
What generating one shader-node library produced.
Output
What generating one library produced: a schema library, or the family of a plugin that declares no schema.
TokenEnum
A Rust enum over one token attribute’s allowedTokens.

Enums§

Error
A failure while generating a schema library.
TokenEnumError
What a configured TokenEnum asked for that could not be honoured.
Views
Whether a library’s views are generated beside its schema data.
Violation
A rule a schema broke.

Functions§

configure
Starts describing what to generate. See Builder.