Loading...
Searching...
No Matches
HdMaterialOverrideSchema Class Reference

The MaterialOverride schema allows overrides to be made to various parts of materials, such as the public UI or shader nodes' parameters. More...

#include <materialOverrideSchema.h>

+ Inheritance diagram for HdMaterialOverrideSchema:

Classes

class  Builder
 Utility class for setting sparse sets of child data source fields to be filled as arguments into BuildRetained. More...
 

Public Member Functions

HD_API HdMaterialNodeParameterSchema GetParameterOverride (const TfToken &shaderNodeName, const TfToken &parameterName) const
 Utility method to retrieve the data source for a parameter edit override.
 
Member accessor
HD_API HdMaterialNodeParameterContainerSchema GetInterfaceValues () const
 Maps interface names (ie.
 
HD_API HdNodeToInputToMaterialNodeParameterSchema GetParameterValues () const
 Contains names of shader nodes whose parameters values are overridden.
 
- Public Member Functions inherited from HdSchema
 HdSchema (HdContainerDataSourceHandle container)
 
HD_API HdContainerDataSourceHandle GetContainer () const
 Returns the container data source that this schema is interpreting.
 
HD_API bool IsDefined () const
 
 operator bool () const
 Returns true if this schema is applied on top of a non-null container.
 

Static Public Member Functions

Schema location
static HD_API const TfTokenGetSchemaToken ()
 Returns a token where the container representing this schema is found in a container by default.
 
static HD_API const HdDataSourceLocatorGetDefaultLocator ()
 Returns an HdDataSourceLocator (relative to the prim-level data source) where the container representing this schema is found by default.
 
Schema construction
static HD_API HdContainerDataSourceHandle BuildRetained (const HdContainerDataSourceHandle &interfaceValues, const HdContainerDataSourceHandle &parameterValues)
 

Schema retrieval

 HdMaterialOverrideSchema (HdContainerDataSourceHandle container)
 
static HD_API HdMaterialOverrideSchema GetFromParent (const HdContainerDataSourceHandle &fromParentContainer)
 Retrieves a container data source with the schema's default name token "materialOverride" from the parent container and constructs a HdMaterialOverrideSchema instance.
 

Additional Inherited Members

- Public Types inherited from HdSchema
using UnderlyingDataSource = HdContainerDataSource
 
- Protected Member Functions inherited from HdSchema
template<typename T >
T::Handle _GetTypedDataSource (TfToken name) const
 Returns a datasource of the requested type for the given name: schema implementations can use this to ask for child containers, sampled values, vectors, etc.
 
- Protected Attributes inherited from HdSchema
HdContainerDataSourceHandle _container
 

Detailed Description

The MaterialOverride schema allows overrides to be made to various parts of materials, such as the public UI or shader nodes' parameters.

Overrides can be applied to material scene index prim locations.

The following is an example of a material override affecting a material's public UI. The data source to author an override on the public UI name "globalSpecularKface" would look like this:

ds at: materialOverride/interfaceValues/globalSpecularKface/value = 0.666

There needs to be an interface mapping defined for "globalSpecularKface", which could look like this:

ds at: material/<renderContext>/interface/parameters/ globalSpecularKface/mappings/[0]/nodePath = MaterialLayer

ds at: material/<renderContext>/interface/parameters/ globalSpecularKface/mappings/[0]/inputName = specularKface

The above means that the "globalSpecularKface" public UI name will map to the node parameter "specularKface", and for example, this node parameter may already have a data source for its value:

ds at: material/<renderContext>/nodes/MaterialLayer/parameters/ specularKface/value = 0.222

After resolving the material override, the data source of the node parameter's value is replaced by the overriding value data source.

ds at: material/<renderContext>/nodes/MaterialLayer/parameters/ specularKface/value = 0.666

The following is an example of a material override affecting a shader node's input parameter value. The data source to author to an override on the input parameter called "useClamp" on shader node named "ManipulateColor" would look like this:

ds at: materialOverride/parameterValues/ManipulateColor/useClamp/ value = 0

The data source of the node parameter's value will be replaced by the overriding value data source.

ds at: material/<renderContext>/nodes/ManipulateColor/parameters/ useClamp/value = 0

Note that the MaterialOverride schema does not specify a render context token because material overrides are high-level and do not need to know about implementation details–they just need to specify an overriding data source. By contrast, the contents of a material network do specify a render context token in order to define the material nodes and interface mappings –you can imagine that a Renderman vs Storm implementation of a material network would be quite different.

In the event where the same parameter has conflicting overrides applied both though interface and parameter values, the overrides set through the interface values will take precedence.

See also the Material schema documentation for ASCII art diagram.

Definition at line 111 of file materialOverrideSchema.h.

Constructor & Destructor Documentation

◆ HdMaterialOverrideSchema()

HdMaterialOverrideSchema ( HdContainerDataSourceHandle  container)
inline

Definition at line 117 of file materialOverrideSchema.h.

Member Function Documentation

◆ BuildRetained()

static HD_API HdContainerDataSourceHandle BuildRetained ( const HdContainerDataSourceHandle &  interfaceValues,
const HdContainerDataSourceHandle &  parameterValues 
)
static
Deprecated:
Use Builder instead.

Builds a container data source which includes the provided child data sources. Parameters with nullptr values are excluded. This is a low-level interface. For cases in which it's desired to define the container with a sparse set of child fields, the Builder class is often more convenient and readable.

◆ GetDefaultLocator()

static HD_API const HdDataSourceLocator & GetDefaultLocator ( )
static

Returns an HdDataSourceLocator (relative to the prim-level data source) where the container representing this schema is found by default.

◆ GetFromParent()

static HD_API HdMaterialOverrideSchema GetFromParent ( const HdContainerDataSourceHandle &  fromParentContainer)
static

Retrieves a container data source with the schema's default name token "materialOverride" from the parent container and constructs a HdMaterialOverrideSchema instance.

Because the requested container data source may not exist, the result should be checked with IsDefined() or a bool comparison before use.

◆ GetInterfaceValues()

HD_API HdMaterialNodeParameterContainerSchema GetInterfaceValues ( ) const

Maps interface names (ie.

public UI names) to overriding data sources that follow the MaterialNodeParameter schema.

◆ GetParameterOverride()

HD_API HdMaterialNodeParameterSchema GetParameterOverride ( const TfToken shaderNodeName,
const TfToken parameterName 
) const

Utility method to retrieve the data source for a parameter edit override.

Returns the data source for the parameter edit of the parameter named parameterName owned by shader node named shaderNodeName.

◆ GetParameterValues()

HD_API HdNodeToInputToMaterialNodeParameterSchema GetParameterValues ( ) const

Contains names of shader nodes whose parameters values are overridden.

Each parameter within a shader node locator contains overriding data sources that follow the MaterialNodeParameter schema.

◆ GetSchemaToken()

static HD_API const TfToken & GetSchemaToken ( )
static

Returns a token where the container representing this schema is found in a container by default.


The documentation for this class was generated from the following file: