1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! UsdVol schema views.
//!
//! Typed value-views over a composed [`crate::usd::Stage`], mirroring Pixar's
//! `UsdVol` family — renderable volumes built from file-backed fields. The
//! views build on the [`geom`](crate::schemas::geom) trait chain: a
//! [`Volume`] is a [`geom::Gprim`](crate::schemas::geom::Gprim) and the field
//! prims are [`geom::Xformable`](crate::schemas::geom::Xformable).
//!
//! ```text
//! geom::Gprim
//! └ Volume (field:<name> relationships)
//! geom::Xformable
//! └ FieldBase (abstract; a transformable single field)
//! └ FieldAsset (abstract; file-backed grid attributes)
//! └ OpenVDBAsset / Field3DAsset
//! ```
//!
//! A [`Volume`] aggregates any number of named fields via `field:<name>`
//! relationships, each targeting a field prim. [`FieldAsset`] is the interface
//! carrying the shared file/grid attributes (`filePath` / `fieldName` /
//! `fieldIndex` / `fieldDataType` / `vectorDataRoleHint`); the concrete
//! [`OpenVDBAsset`] (an OpenVDB grid) and [`Field3DAsset`] (a Field3D file) add
//! their own `fieldClass` / `fieldPurpose`.
//!
//! The newer `ParticleField*` schemas (Gaussian-splat volumes) are a separate,
//! larger subsystem and are not covered here.
//!
//! # Example
//!
//! ```
//! use openusd::schemas::vol::{self, FieldAsset};
//! use openusd::{sdf, usd};
//!
//! let stage = usd::Stage::builder().in_memory("scene.usda").unwrap();
//!
//! // A field is a file-backed grid prim; `create_file_path_attr` is inherited
//! // from the `FieldAsset` interface.
//! let field = vol::OpenVDBAsset::define(&stage, "/Smoke/density").unwrap();
//! field.create_file_path_attr().unwrap().set(sdf::Value::AssetPath("./smoke.vdb".into())).unwrap();
//! field.create_field_name_attr().unwrap().set("density".to_string()).unwrap();
//!
//! // A Volume binds named fields through `field:<name>` relationships.
//! let volume = vol::Volume::define(&stage, "/Smoke").unwrap()
//! .create_field_relationship("density", "/Smoke/density").unwrap();
//!
//! assert_eq!(
//! volume.field_paths().unwrap(),
//! vec![("density".to_string(), sdf::path("/Smoke/density").unwrap())],
//! );
//! ```
pub use ;
pub use ;
use *;
/// Implement the schema-trait chain for a concrete `struct $ty(Prim)` vol
/// newtype. Every arm hand-writes the one `SchemaBase` method (`prim`) and adds
/// the empty membership impls for the chain it names; all trait paths are fully
/// qualified, so the call site only needs the macro in scope.
///
/// - `gprim` is a [`geom::Gprim`](crate::schemas::geom::Gprim) (`Volume`).
/// - `field_asset` adds [`FieldBase`] + [`FieldAsset`] on top of
/// [`geom::Xformable`](crate::schemas::geom::Xformable) (`OpenVDBAsset`,
/// `Field3DAsset`).
pub use impl_vol_schema;
/// The geometric role of a vector-valued field (the `vectorDataRoleHint`
/// token). Per Pixar's spec the default (unauthored) is
/// [`VectorDataRoleHint::NoRole`].
// `From`/`TryFrom<Value>` so the hint passes straight to `Attribute::set` and
// `get::<VectorDataRoleHint>()`.
crateimpl_token_value!;