Skip to content

mxpv/openusd

Repository files navigation

openusd

Crates.io Version docs.rs CI codecov dependency status

openusd is a Rust implementation of Pixar's Universal Scene Description (USD) format with no C++ dependencies.

Documentation

The following list of docs was used during crate development:

For a detailed comparison with the C++ reference implementation and current progress, see the Roadmap.

Features

  • Reads all major USD formats: .usda (text), .usdc (binary), and .usdz (archive).
  • Composed Stage with full LIVERPS strength ordering (sublayers, inherits, variants, references, payloads, specializes).
  • Recursive layer collection with cycle detection, format auto-detection, and expression evaluation.
  • List-edit composition (prepend, append, add, delete, explicit) across layers.
  • Generic typed field access via Stage::field<T> with TryFrom<Value> conversion.
  • Variable expression evaluator for USD's expression syntax.
  • Asset resolution with pluggable Resolver trait, filesystem DefaultResolver, and search paths.

If you encounter a file that can't be read, please open an issue and attach the USD file for investigation.

Example

use openusd::{ar, sdf::FieldKey, Stage};

// Open a stage with default settings (DefaultResolver, strict errors).
let stage = Stage::open("scene.usda")?;

// Or configure via the builder:
let stage = Stage::builder()
    // Use a custom asset resolver (default: DefaultResolver).
    .resolver(ar::DefaultResolver::new())
    // Handle composition errors instead of failing (default: hard error).
    .on_error(|err| {
        eprintln!("warning: {err}");
        Ok(()) // skip missing dependency and continue
    })
    .open("scene.usda")?;

// Traverse all prims in the composed scene graph.
stage.traverse(|path| {
    println!("{path}");
})?;

// Read a typed field value (generic over TryFrom<Value>).
let active: Option<bool> = stage.field("/World/Cube", FieldKey::Active)?;

// Access children composed across layers, references, and payloads.
let children = stage.prim_children("/World/Cube")?;
let properties = stage.prim_properties("/World/Cube")?;

Getting started

To begin, simply clone the repository including its submodules. Make sure you have Rust installed on your system, rustup will do the rest.

# Clone the project
git clone --recurse-submodules https://github.com/mxpv/openusd.git
cd openusd

# Use cargo to build, test, lint, etc.
cargo build
cargo clippy

# Run examples
cargo run --example dump_usdc -- ~/caldera/layers/cameras.usd

Minimum supported Rust version (MSRV)

The project typically targets the latest stable Rust version. Please refer to rust-toolchain.toml for exact version currently used by our CIs.

Note

This crate is under active development. No API stability is guaranteed until version 1.0.

About

Native Rust USD library

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors

Languages