geometry
geometry
Transforms, visibility, basic shapes and materials.
Attributes
PURPOSES = ('default', 'render', 'proxy', 'guide')
module-attribute
Functions:
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 | |
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 | |
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_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_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 | |
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_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_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 | |