usd
Houdini-specific USD Library functions.
add_usd_output_processor(ropnode, processor)
Add USD Output Processor to USD Rop node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ropnode | RopNode | The USD Rop node. | required |
processor | str | The output processor name. This is the basename of the python file that contains the Houdini USD Output Processor. | required |
Source code in client/ayon_houdini/api/usd.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
get_ayon_entity_uri_from_representation_context(context)
Resolve AYON Entity URI from representation context.
Note
The representation context is the get_representation_context
dict containing the project
, folder,
representationand so forth. It is not the representation entity
context` key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context | dict | The representation context. | required |
Raises:
Type | Description |
---|---|
RuntimeError | Unable to resolve to a single valid URI. |
Returns:
Name | Type | Description |
---|---|---|
str | str | The AYON entity URI. |
Source code in client/ayon_houdini/api/usd.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
get_configured_save_layers(usd_rop, strip_above_layer_break=True)
Retrieve the layer save paths from a USD ROP.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
usdrop | RopNode | USD Rop Node | required |
strip_above_layer_break | Optional[bool] | Whether to exclude any layers that are above layer breaks. This defaults to True. | True |
Returns:
Type | Description |
---|---|
List[Sdf.Layer]: The layers with configured save paths. |
Source code in client/ayon_houdini/api/usd.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 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
get_layer_save_path(layer, expand_string=True)
Get custom HoudiniLayerInfo->HoudiniSavePath from SdfLayer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer | Layer | The Layer to retrieve the save pah data from. | required |
expand_string | bool | Whether to expand any houdini vars in the save path before computing the absolute path. | True |
Returns:
Type | Description |
---|---|
str or None: Path to save to when data exists. |
Source code in client/ayon_houdini/api/usd.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
get_referenced_layers(layer)
Return SdfLayers for all external references of the current layer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer | Layer | The Layer to retrieve the save pah data from. | required |
Returns:
Name | Type | Description |
---|---|---|
list | List of pxr.Sdf.Layer that are external references to this layer |
Source code in client/ayon_houdini/api/usd.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
get_schema_type_names(type_name)
Return schema type name for type name and its derived types
This can be useful for checking whether a Sdf.PrimSpec
's type name is of a given type or any of its derived types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_name | str | The type name, like e.g. 'UsdGeomMesh' | required |
Returns:
Type | Description |
---|---|
List[str] | List[str]: List of schema type names and their derived types. |
Source code in client/ayon_houdini/api/usd.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
|
get_usd_render_rop_rendersettings(rop_node, stage=None, logger=None)
Return the chosen UsdRender.Settings from the stage (if any).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rop_node | Node | The Houdini USD Render ROP node. | required |
stage | Stage | The USD stage to find the render settings in. This is usually the stage from the LOP path the USD Render ROP node refers to. | None |
logger | Logger | Logger to log warnings to if no render settings were find in stage. | None |
Returns:
Type | Description |
---|---|
Optional[UsdRender.Settings]: Render Settings. |
Source code in client/ayon_houdini/api/usd.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
|
iter_layer_recursive(layer)
Recursively iterate all 'external' referenced layers
Source code in client/ayon_houdini/api/usd.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
outputprocessors(ropnode, processors=tuple(), disable_all_others=True)
Context manager to temporarily add Output Processors to USD ROP node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ropnode | RopNode | The USD Rop node. | required |
processors | tuple or list | The processors to add. | tuple() |
disable_all_others | (bool, Optional) | Whether to disable all output processors currently on the ROP node that are not in the | True |
Source code in client/ayon_houdini/api/usd.py
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
remap_paths(rop_node, mapping)
Enable the AyonRemapPaths output processor with provided mapping
Source code in client/ayon_houdini/api/usd.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
remove_usd_output_processor(ropnode, processor)
Removes USD Output Processor from USD Rop node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ropnode | RopNode | The USD Rop node. | required |
processor | str | The output processor name. This is the basename of the python file that contains the Houdini USD Output Processor. | required |
Source code in client/ayon_houdini/api/usd.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
setup_lop_python_layer(layer, node, savepath=None, apply_file_format_args=True)
Set up Sdf.Layer with HoudiniLayerInfo prim for metadata.
This is the same as loputils.createPythonLayer
but can be run on top of pxr.Sdf.Layer
instances that are already created in a Python LOP node. That's useful if your layer creation itself is built to be DCC agnostic, then we just need to run this after per layer to make it explicitly stored for houdini.
By default, Houdini doesn't apply the FileFormatArguments supplied to the created layer; however it does support USD's file save suffix of :SDF_FORMAT_ARGS:
to supply them. With apply_file_format_args
any file format args set on the layer's creation will be added to the save path through that.
The node.addHeldLayer
call will only work from a LOP python node
whenever node.editableStage()
or node.editableLayer()
was called.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer | Layer | An existing layer (most likely just created in the current runtime) | required |
node | LopNode | The Python LOP node to attach the layer to so it does not get garbage collected/mangled after the downstream. | required |
savepath | Optional[str] | When provided the HoudiniSaveControl will be set to Explicit with HoudiniSavePath to this path. | None |
apply_file_format_args | Optional[bool] | When enabled any FileFormatArgs defined for the layer on creation will be set in the HoudiniSavePath so Houdini USD ROP will use them top. | True |
Returns:
Type | Description |
---|---|
Sdf.PrimSpec: The Created HoudiniLayerInfo prim spec. |
Source code in client/ayon_houdini/api/usd.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 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 284 |
|