Skip to main content

openusd_rs/sdf/
mod.rs

1//! Scene Description Foundations
2
3mod abstract_data;
4mod list_op;
5mod path;
6mod path_node;
7mod path_parser;
8mod schema;
9
10pub use abstract_data::*;
11pub use list_op::*;
12pub use path::*;
13pub use schema::{CHILDREN_KEYS, FIELD_KEYS};
14
15use crate::vt;
16
17/// An enum that specifies the type of an object.
18/// Objects have fields and are adressable by path.
19#[repr(u32)]
20#[derive(Debug, Clone, Copy, PartialEq)]
21pub enum SpecType {
22	// Note: Do not change the order, it is used in the binary format!
23	Unknown = 0,
24	Attribute,
25	Connection,
26	Expression,
27	Mapper,
28	MapperArg,
29	Prim,
30	PseudoRoot,
31	Relationship,
32	RelationshipTarget,
33	Variant,
34	VariantSet,
35}
36
37/// An enum that identifies the possible specifiers for a PrimSpec.
38#[derive(Debug, Clone, Copy, PartialEq)]
39pub enum Specifier {
40	Def,
41	Over,
42	Class,
43}
44
45/// An enum that defines permission levels.
46#[derive(Debug, Clone, Copy)]
47pub enum Permission {
48	Public,
49	Private,
50}
51
52/// An enum that identifies variability types for attributes.
53#[derive(Debug, Clone, Copy)]
54pub enum Variability {
55	Varying,
56	Uniform,
57}
58
59/// Represents a time offset and scale between layers.
60#[derive(Debug, Default, Clone)]
61pub struct LayerOffset {
62	pub offset: f64,
63	pub scale: f64,
64}
65
66/// Represents a reference and all its meta data.
67#[derive(Debug, Default, Clone)]
68pub struct Reference {
69	/// The asset path to the external layer.
70	pub asset_path: String,
71	/// The path to the referenced prim in the external layer.
72	pub prim_path: Path,
73	/// The layer offset to transform time.
74	pub layer_offset: LayerOffset,
75	/// The custom data associated with the reference.
76	pub custom_data: vt::Dictionary,
77}
78
79/// Represents a payload and all its meta data.
80#[derive(Debug, Default, Clone)]
81pub struct Payload {
82	/// The asset path to the external layer.
83	pub asset_path: String,
84	/// The root prim path to the referenced prim in the external layer.
85	pub prim_path: Path,
86	/// The layer offset to transform time.
87	pub layer_offset: LayerOffset,
88}
89
90/// A single relocate specifying a source and target path for a relocation.
91pub struct Relocate {
92	pub source: Path,
93	pub target: Path,
94}
95
96/// Contains an asset path and optional evaluated and resolved paths.
97#[derive(Debug, Clone, PartialEq)]
98pub struct AssetPath {
99	pub authored_path: String,
100	pub evaluated_path: String,
101	pub resolved_path: String,
102}