prims
prims
Querying and editing prims.
Functions:
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 | |
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 | |
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 | |
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 | |
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_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 | |
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 | |
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 | |
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 | |
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_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_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 | |