#unsafe-bindings #vfx #pxr #usd

sys pxr_sys

Rust interface for OpenUSD

4 releases

0.2.0 Apr 27, 2024
0.1.2 Jan 9, 2024
0.1.1 Jan 8, 2024
0.1.0 Jan 5, 2024

#405 in Simulation

Download history 17/week @ 2024-06-13 19/week @ 2024-06-20 7/week @ 2024-06-27 23/week @ 2024-07-11 29/week @ 2024-07-18 10/week @ 2024-07-25 17/week @ 2024-08-01 9/week @ 2024-08-08 2/week @ 2024-08-15 1/week @ 2024-08-22 8/week @ 2024-08-29 8/week @ 2024-09-05 21/week @ 2024-09-12 35/week @ 2024-09-19 15/week @ 2024-09-26

81 downloads per month
Used in 4 crates (via pxr)

MIT/Apache

210KB
5.5K SLoC

pxr_rs

crates.io Rust Docker deps.rs codecov.io

Rust interface for OpenUSD.

Status

This project is in early development and is not ready for production use. Not all of the OpenUSD API is currently exposed.

Documentation and examples are currently lacking but will be the focus once the crates are more stable.

Currently, OpenUSD 22.11 compiled via build options specified via the default features of pxr_sys is the primary target upon which the project is being developed.

Overview

The workspace contains these packages:

  • pxr_build: Helper crate for building OpenUSD bindings
  • pxr_sys: Unsafe Rust bindings for OpenUSD
  • pxr: Safe Rust bindings for OpenUSD (WIP)

Most of the bindings are automatically generated from the OpenUSD headers using autocxx, while some are hand-written via rust-cpp and additional macros inside pxr_build. The C++ library of OpenUSD can be automatically downloaded and compiled during the cargo build process if the vendored feature is enabled.

Dependencies

The complete list of dependencies can be found within Dockerfile.

Enabling of additional non-default features might require additional dependencies. This is currently not tested/documented.

Instructions

Rust

Add pxr as a Rust dependency to your Cargo.toml manifest.

[dependencies]
pxr = { version = "0.2" }

Note that the first build might take up to 50 minutes because OpenUSD will be automatically downloaded and compiled with the vendored feature enabled. The artifacts will be cached in OUT_DIR and reused for subsequent builds.

Alternatively, you can specify the path to an existing OpenUSD installation directory via the following environment variable.

export OPENUSD_PATH=/path/to/pxr/openusd

It is highly recommended to use lld or mold linker because ld might currently fail.

Docker

To install Docker on your system, you can run .docker/host/install_docker.bash to configure Docker with NVIDIA GPU support.

.docker/host/install_docker.bash

Build Image

To build a new Docker image from Dockerfile, you can run .docker/build.bash as shown below.

.docker/build.bash ${TAG:-latest} ${BUILD_ARGS}

Run Container

To run the Docker container, you can use .docker/run.bash as shown below.

.docker/run.bash ${TAG:-latest} ${CMD}

Run Dev Container

To run the Docker container in a development mode (source code mounted as a volume), you can use .docker/dev.bash as shown below.

.docker/dev.bash ${TAG:-latest} ${CMD}

As an alternative, VS Code users familiar with Dev Containers can modify the included .devcontainer/devcontainer.json to their needs. For convenience, .devcontainer/open.bash script is available to open this repository as a Dev Container in VS Code.

.devcontainer/open.bash

Join Container

To join a running Docker container from another terminal, you can use .docker/join.bash as shown below.

.docker/join.bash ${CMD:-bash}

Disclaimer

This project is not affiliated with the Alliance for OpenUSD (AOUSD).

License

This project is dual-licensed to be compatible with the Rust project, under either the MIT or Apache 2.0 licenses.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~3.5–9MB
~170K SLoC