_common
_common
What the operations share: the opened stages and the conversion of values.
Not operations themselves, nodes don't call anything here.
Attributes
STAGES = {}
module-attribute
Opened stages by handle, the identifier of their root layer.
Functions:
get_attribute_of(prim, attr, type_name='', create=False)
Get an attribute of a prim, optionally creating it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prim
|
Prim
|
prim holding the attribute. |
required |
attr
|
str
|
attribute name. |
required |
type_name
|
str
|
value type like |
''
|
create
|
bool
|
create the attribute if it is missing. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
the attribute is missing and can't be created, because |
Returns:
| Type | Description |
|---|---|
Attribute
|
Usd.Attribute: the attribute. |
Source code in src/nyx_usd/ops/_common.py
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 | |
get_prim(handle, prim_path)
Get a prim that has to exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handle
|
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 |
|---|---|
Prim
|
Usd.Prim: the prim. |
Source code in src/nyx_usd/ops/_common.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
get_stage(handle)
Get an opened stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handle
|
str
|
handle given by |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
the stage was never opened, or it was closed. |
Returns:
| Type | Description |
|---|---|
Stage
|
Usd.Stage: the stage. |
Source code in src/nyx_usd/ops/_common.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
register(stage)
Keep a stage open.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
Stage
|
stage to keep. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
handle of the stage, the identifier of its root layer. |
Source code in src/nyx_usd/ops/_common.py
16 17 18 19 20 21 22 23 24 25 26 27 | |
to_json(value)
Convert a USD value to JSON data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
value of an attribute or of metadata. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
JSON value. Vectors, matrices and arrays become lists, dictionaries
stay dictionaries, what can't be converted its |
Source code in src/nyx_usd/ops/_common.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
to_usd(value, type_name)
Convert JSON data to what an attribute of a type takes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
JSON value. Lists become vectors, matrices and arrays. |
required |
type_name
|
ValueTypeName
|
type of the attribute. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
value for |
Source code in src/nyx_usd/ops/_common.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |