Skip to main content

Module ar

Module ar 

Source
Expand description

Asset resolution framework.

USD layers reference external assets through asset paths — the @...@ syntax in .usda files. These paths appear in sublayers, references, payloads, and asset-valued attributes. An asset path is a logical identifier that may be relative, absolute, or use package-relative notation (Model.usdz[Geom.usd]).

This module resolves those logical paths to physical locations that can be opened and read. It corresponds to the C++ Ar (Asset Resolution) module: https://openusd.org/dev/api/ar_page_front.html

The Resolver trait defines the resolution interface. The DefaultResolver provides a filesystem-based implementation that searches configurable directories for matching files. Custom resolvers can map asset paths to databases, cloud storage, or other backends.

§Example

use openusd::ar::{DefaultResolver, Resolver};

let resolver = DefaultResolver::new();
if let Some(resolved) = resolver.resolve("model.usda") {
    let mut asset = resolver.open_asset(&resolved).unwrap();
    let data = asset.read_all().unwrap();
}

Structs§

AssetInfo
Metadata about a resolved asset.
CacheHandle
A cache scope’s cache, by reference: clones share the one cache, and the cache is released when the last of them drops.
CacheScope
A cache scope (C++ ArResolverScopedCache): a span, on one thread, over which work that asks for the same asset several times keeps what it opened, such as a package’s directory. The scope ends when the guard drops.
DefaultResolver
Default filesystem-based asset resolver.
ResolvedPath
A resolved asset path representing the physical location of an asset.
SharedBuffer
A view of bytes a SharedSource holds: the range of the source it covers, which it never outgrows. A clone shares the source, and slice narrows the range without copying. A package entry is therefore a view of its package, and a layer’s bytes a view of its asset.

Enums§

Advice
How a range of shared bytes is about to be read, for a source that can prepare for it (C++ ArchMemAdvice).
AssetBuffer
The bytes a layer decodes from: an asset’s complete contents, as Asset::into_buffer yields them, or bytes that never were an asset, compiled into the program or handed over by a host. They live as long as the layer because a decoder may keep reading them: the crate format indexes into the buffer in place, while the text format copies out what it keeps.

Traits§

Asset
Readable asset handle returned by Resolver::open_asset.
Resolver
Interface for resolving asset paths to physical locations.
SharedSource
The backing a SharedBuffer views: bytes whose length and contents are fixed for as long as the source lives. The trait is sealed since every view relies on that promise; the sources are &'static [u8], Vec<u8>, Arc<[u8]> and, with the mmap feature, a read-only file mapping, whose promise is the one DefaultResolver::map_files has its caller make.

Functions§

is_package_relative_path
Returns true if the path contains a package-relative component (bracket syntax).
join_package_relative_path
Joins a package path and an inner path into a package-relative path.
split_package_relative_path_inner
Splits a package-relative path at the innermost bracket.
split_package_relative_path_outer
Splits a package-relative path at the outermost bracket.