addPreviewMaterialInterface#

Fully qualified name: usdex::core::addPreviewMaterialInterface

bool usdex::core::addPreviewMaterialInterface(
pxr::UsdShadeMaterial &material,
)#

Adds UsdShadeInputs to the material prim to create an “interface” to the underlying Preview Shader network.

All non-default-value UsdShadeInputs on the effective surface shader for the universal render context will be “promoted” to the UsdShadeMaterial as new UsdShadeInputs. They will be connected to the original source inputs on the shaders, to drive those values, and they will be authored with a value matching what had been set on the shader inputs at the time this function was called.

Additionally, UsdUVTexture.file inputs on connected shaders will be promoted to the material, following the same logic as direct surface inputs.

Note

It is preferable to author all initial shader attributes (including textures) before calling addPreviewMaterialInterface().

Warning

This function will fail if there is any other render context driving the material surface. It is only suitable for use on Preview Shader networks, such as the network generated by definePreviewMaterial() and its associated add*Texture functions. If you require multiple contexts, you should instead construct a Material Interface directly, or with targetted end-user interaction.

Parameters:

material – The material prim

Returns:

Whether or not the Material inputs were added successfully