ops
ops
USD operations run by Nyx nodes in an interpreter that has pxr.
Plain functions that take and return JSON data. Nothing here imports Nyx or the
bridge, so the package works in any application shipping pxr (an OpenUSD build,
Maya, Houdini, Blender).
A stage is identified by the identifier of its root layer, a string. The opened stages
are kept in this package until they are closed, so one node can edit what the previous
one opened. They stay open until close_stage or close_all, or the process ends.
The nodes call nyx_usd.ops.<name>, so every operation is imported here.
Attributes
__all__ = ['add_inherit', 'add_payload', 'add_prim', 'add_reference', 'add_sublayer', 'add_variant_set', 'bind_material', 'close_all', 'close_stage', 'copy_prim', 'create_cube', 'create_material', 'create_mesh', 'create_sphere', 'create_stage', 'export_to_string', 'find_prims', 'flatten_stage', 'get_attribute', 'get_attribute_at_time', 'get_bounding_box', 'get_children', 'get_parent', 'get_prim_metadata', 'get_prim_type', 'get_stage_info', 'get_stage_metadata', 'get_time_range', 'get_time_samples', 'get_transform', 'get_variants', 'get_world_transform', 'has_prim', 'list_attributes', 'list_prims', 'list_sublayers', 'move_prim', 'open_stage', 'remove_attribute', 'remove_prim', 'remove_sublayer', 'rename_prim', 'save_stage', 'set_active', 'set_attribute', 'set_attribute_at_time', 'set_default_prim', 'set_fps', 'set_kind', 'set_meters_per_unit', 'set_prim_metadata', 'set_purpose', 'set_stage_metadata', 'set_time_range', 'set_transform', 'set_up_axis', 'set_variant_selection', 'set_visibility']
module-attribute
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_prim(stage, prim_path, type_name='Xform')
Define a prim, creating the prims above it as needed, without a type.
Define a parent first to give it a type, like Xform: an untyped prim can't be
transformed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim, like |
required |
type_name
|
str
|
schema type of the prim, like |
'Xform'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
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 | |
bind_material(stage, prim_path, material_path)
Bind a material to a prim and what is below it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
material_path
|
str
|
path of the material prim. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at a path, or |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
close_all()
Close every opened stage without saving.
Source code in src/nyx_usd/ops/stages.py
51 52 53 | |
close_stage(stage)
Close a stage without saving it. Does nothing if it is not open.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
Source code in src/nyx_usd/ops/stages.py
42 43 44 45 46 47 48 | |
copy_prim(stage, prim_path, new_path)
Copy a prim with everything below it, in the layer the stage edits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
new_path
|
str
|
path of the copy. The prims above it are created if missing. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the layer has no spec to copy. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
create_cube(stage, prim_path, size=1.0)
Define a cube prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
size
|
float
|
length of an edge. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
186 187 188 189 190 191 192 193 194 195 196 197 198 | |
create_material(stage, prim_path, diffuse_color=None)
Define a material with a UsdPreviewSurface shader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the material. The shader is |
required |
diffuse_color
|
list[float] | None
|
red, green and blue, |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the color doesn't have three numbers. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
create_mesh(stage, prim_path, points, face_vertex_counts, face_vertex_indices)
Define a polygon mesh prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
points
|
list[list[float]]
|
position of every vertex, as x, y and z. |
required |
face_vertex_counts
|
list[int]
|
number of vertices of every face. |
required |
face_vertex_indices
|
list[int]
|
vertex of every corner of every face. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
the counts and the indices don't fit, or an index is out of range. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
create_sphere(stage, prim_path, radius=1.0)
Define a sphere prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
radius
|
float
|
radius of the sphere. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
201 202 203 204 205 206 207 208 209 210 211 212 213 | |
create_stage(path='')
Create a stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
file the stage is saved to. In memory only if empty. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stages.py
29 30 31 32 33 34 35 36 37 38 39 | |
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 | |
find_prims(stage, name_pattern, type_name='')
Find prims by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
name_pattern
|
str
|
regular expression searched in the name of the prims, not their whole path. |
required |
type_name
|
str
|
only the prims of this schema type, all if empty. |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: paths of the prims that match. |
Source code in src/nyx_usd/ops/prims.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
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_attribute(stage, prim_path, attr)
Get the value of an attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
attr
|
str
|
attribute name. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or no such attribute. |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
JSON value, None if the attribute has no value. |
Source code in src/nyx_usd/ops/attributes.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
get_attribute_at_time(stage, prim_path, attr, time=0.0)
Get the value of an attribute at a time, interpolated between samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
attr
|
str
|
attribute name. |
required |
time
|
float
|
time code to read. |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or no such attribute. |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
JSON value, None if the attribute has no value. |
Source code in src/nyx_usd/ops/attributes.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
get_bounding_box(stage, prim_path)
Get the bounds of a prim and what is below it, in the world.
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 |
|---|---|
list[list[float]]
|
list[list[float]]: the minimum and maximum corner. Empty bounds have a minimum larger than the maximum. |
Source code in src/nyx_usd/ops/geometry.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
get_children(stage, prim_path)
List the paths of the children 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 |
|---|---|
list[str]
|
list[str]: paths of the children. |
Source code in src/nyx_usd/ops/prims.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
get_parent(stage, prim_path)
Get the path of the parent 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:
| Name | Type | Description |
|---|---|---|
str |
str
|
path of the parent, |
Source code in src/nyx_usd/ops/prims.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
get_prim_metadata(stage, prim_path, key)
Get a metadata field of a prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
key
|
str
|
metadata key. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
there is no prim at the path. |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
JSON value, None if the field is not set. |
Source code in src/nyx_usd/ops/prims.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
get_prim_type(stage, prim_path)
Get the schema type 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:
| Name | Type | Description |
|---|---|---|
str |
str
|
type name like |
Source code in src/nyx_usd/ops/prims.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
get_stage_info(stage)
Describe a stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: |
Source code in src/nyx_usd/ops/stage_settings.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
get_stage_metadata(stage, key)
Get a metadata field of the stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
key
|
str
|
metadata key. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
JSON value, None if the field is not set. |
Source code in src/nyx_usd/ops/stage_settings.py
35 36 37 38 39 40 41 42 43 44 45 | |
get_time_range(stage)
Get the first and last time code of the stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
Returns:
| Type | Description |
|---|---|
list[float]
|
list[float]: start and end time code. |
Source code in src/nyx_usd/ops/stage_settings.py
70 71 72 73 74 75 76 77 78 79 80 | |
get_time_samples(stage, prim_path, attr)
List the times an attribute has a value at.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
attr
|
str
|
attribute name. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or no such attribute. |
Returns:
| Type | Description |
|---|---|
list[float]
|
list[float]: time codes, empty for an attribute without animation. |
Source code in src/nyx_usd/ops/attributes.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
get_transform(stage, prim_path)
Get the local transform of a prim as a 4x4 matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or it can't be transformed. |
Returns:
| Type | Description |
|---|---|
list[list[float]]
|
list[list[float]]: the matrix, as rows. |
Source code in src/nyx_usd/ops/geometry.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
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 | |
get_world_transform(stage, prim_path)
Get the transform of a prim in the world as a 4x4 matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or it can't be transformed. |
Returns:
| Type | Description |
|---|---|
list[list[float]]
|
list[list[float]]: the matrix, as rows. |
Source code in src/nyx_usd/ops/geometry.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
has_prim(stage, prim_path)
Check whether a prim exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
there is a prim at the path. |
Source code in src/nyx_usd/ops/prims.py
66 67 68 69 70 71 72 73 74 75 76 | |
list_attributes(stage, prim_path)
List the names of the attributes 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 |
|---|---|
list[str]
|
list[str]: attribute names, the ones of its schema included. |
Source code in src/nyx_usd/ops/attributes.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
list_prims(stage, type_name='')
List the paths of the prims of a stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
type_name
|
str
|
only the prims of this schema type, all if empty. |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: prim paths. |
Source code in src/nyx_usd/ops/prims.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
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 | |
move_prim(stage, prim_path, new_parent_path)
Move a prim under another parent, in the layer the stage edits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
new_parent_path
|
str
|
path of the new parent, |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the layer can't move it. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
open_stage(path)
Open a USD file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
file to open. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
the file can't be opened. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stages.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
remove_attribute(stage, prim_path, attr)
Remove an attribute from the layer the stage edits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
attr
|
str
|
attribute name. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the attribute can't be removed. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/attributes.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
remove_prim(stage, prim_path)
Remove 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:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
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 | |
rename_prim(stage, prim_path, new_name)
Rename a prim, in the layer the stage edits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
new_name
|
str
|
new name, without the path. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the layer can't rename it. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
save_stage(stage, path='')
Save a stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
path
|
str
|
file to export the stage to, its own file if empty. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stages.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
set_active(stage, prim_path, active=True)
Activate or deactivate a prim. A deactivated prim is left out of traversals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
active
|
bool
|
whether the prim is active. |
True
|
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/prims.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
set_attribute(stage, prim_path, attr, value, type_name='')
Set the value of an attribute, creating the attribute if it is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
attr
|
str
|
attribute name. |
required |
value
|
Any
|
JSON value. A list is turned into the vector, matrix or array the attribute type calls for. |
required |
type_name
|
str
|
value type of the attribute to create, like |
''
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the attribute is missing and the type is unknown. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/attributes.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
set_attribute_at_time(stage, prim_path, attr, value, time=0.0, type_name='')
Set the value of an attribute at a time, creating the attribute if it is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
attr
|
str
|
attribute name. |
required |
value
|
Any
|
JSON value, see |
required |
time
|
float
|
time code the value is for. |
0.0
|
type_name
|
str
|
value type of the attribute to create, see |
''
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the attribute is missing and the type is unknown. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/attributes.py
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 | |
set_default_prim(stage, prim_path)
Set the prim that is referenced when the file is referenced without a target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim, a root prim. |
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/stage_settings.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
set_fps(stage, fps=24.0)
Set the frames per second, and the time codes per second with it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
fps
|
float
|
frames per second. |
24.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the rate is not positive. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stage_settings.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
set_kind(stage, prim_path, kind)
Set the kind of a prim, like component or assembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
kind
|
str
|
kind to set. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the kind can't be set. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
set_meters_per_unit(stage, meters=1.0)
Set the size of a unit of the stage in meters, 0.01 for centimeters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
meters
|
float
|
meters per unit. |
1.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the value is not positive. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stage_settings.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
set_prim_metadata(stage, prim_path, key, value=None)
Set a metadata field of a prim, like documentation or customData.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
key
|
str
|
metadata key. |
required |
value
|
Any
|
JSON value. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or the value doesn't fit the key. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/prims.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
set_purpose(stage, prim_path, purpose='default')
Set the purpose of a prim: what it is drawn for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
purpose
|
str
|
|
'default'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, it has no purpose, or the purpose is unknown. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
set_stage_metadata(stage, key, value=None)
Set a metadata field of the stage, like comment or documentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
key
|
str
|
metadata key. |
required |
value
|
Any
|
JSON value. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the value doesn't fit the key. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stage_settings.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
set_time_range(stage, start=0.0, end=100.0)
Set the first and last time code of the stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
start
|
float
|
first time code. |
0.0
|
end
|
float
|
last time code. |
100.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the end is before the start. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stage_settings.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
set_transform(stage, prim_path, translate=None, rotate=None, scale=None)
Set the local transform of a prim, replacing the transform operations it has.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
translate
|
list[float] | None
|
x, y and z, |
None
|
rotate
|
list[float] | None
|
x, y and z rotation in degrees, |
None
|
scale
|
list[float] | None
|
x, y and z, |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, it can't be transformed, or a list doesn't have three numbers. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
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 | |
set_up_axis(stage, axis='Y')
Set the up axis of the stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
axis
|
str
|
|
'Y'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the axis is not Y or Z. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/stage_settings.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
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 | |
set_visibility(stage, prim_path, visible=True)
Show or hide a prim and what is below it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
stage handle. |
required |
prim_path
|
str
|
path of the prim. |
required |
visible
|
bool
|
whether the prim is visible. |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
no prim at the path, or it has no visibility. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage. |
Source code in src/nyx_usd/ops/geometry.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |