composition
composition
Layers, references, payloads, inherits and variants, and exporting the result.
Functions:
add_inherit(stage, prim_path, class_path)
Make a prim inherit from a class prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
class_path
|
str
|
path of the class prim, like |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
there is no prim at the path. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
add_payload(stage, prim_path, asset_path, target_prim='')
Add a payload of a USD file to a prim, defining the prim if needed.
A payload is a reference that can be left unloaded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
asset_path
|
str
|
file to load. |
required |
target_prim
|
str
|
prim of the file to load, its default prim if empty. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
add_reference(stage, prim_path, asset_path, target_prim='')
Reference a USD file on a prim, defining the prim if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
asset_path
|
str
|
file to reference. |
required |
target_prim
|
str
|
prim of the file to reference, like |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
add_sublayer(stage, layer_path)
Add a layer file to the sublayers of the root layer, as the weakest one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
layer_path
|
str
|
layer file to add. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
75 76 77 78 79 80 81 82 83 84 85 86 | |
add_variant_set(stage, prim_path, set_name, variants)
Add a variant set with variants to a prim. Existing variants are kept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
set_name
|
str
|
name of the variant set. |
required |
variants
|
list[str]
|
names of the variants. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
there is no prim at the path. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
export_to_string(stage, flatten=False)
Get the USD text of a stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
flatten
|
bool
|
compose everything into one layer first, instead of giving the root layer as it is. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
USDA text. |
Source code in src/nyx_usd/ops/composition.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
flatten_stage(stage, path)
Compose a stage into one layer and write it to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
path
|
str
|
file to write. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
the file can't be written. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the path of the file. |
Source code in src/nyx_usd/ops/composition.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
get_variants(stage, prim_path)
Describe the variant sets of a prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
there is no prim at the path. |
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
dict[str, dict]: by set name, its |
Source code in src/nyx_usd/ops/composition.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
list_sublayers(stage)
List the sublayers of the root layer, the strongest first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: layer paths. |
Source code in src/nyx_usd/ops/composition.py
109 110 111 112 113 114 115 116 117 118 | |
remove_sublayer(stage, layer_path)
Remove a layer from the sublayers of the root layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
layer_path
|
str
|
layer file to remove, as it was added. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
the layer is not a sublayer. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
set_variant_selection(stage, prim_path, set_name, variant)
Select a variant of a variant set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
set_name
|
str
|
name of the variant set. |
required |
variant
|
str
|
variant to select, empty to clear the selection. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or no such variant set or variant. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/composition.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |