attributes
attributes
Reading and writing attributes, with and without time.
Functions:
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_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 | |
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 | |
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 | |
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 | |