All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdShadeShaderDefUtils Class Reference

This class contains a set of utility functions used for populating the shader registry with shaders definitions specified using UsdShade schemas. More...

Static Public Member Functions

static USDSHADE_API bool SplitShaderIdentifier (const TfToken &identifier, TfToken *familyName, TfToken *implementationName, NdrVersion *version)
 Given a shader's identifier token, computes the corresponding SdrShaderNode's family name, implementation name and shader version (as NdrVersion). More...
 
static USDSHADE_API
NdrNodeDiscoveryResultVec 
GetNodeDiscoveryResults (const UsdShadeShader &shaderDef, const std::string &sourceUri)
 Returns the list of NdrNodeDiscoveryResult objects that must be added to the shader registry for the given shader shaderDef, assuming it is found in a shader definition file found by an Ndr discovery plugin. More...
 
static USDSHADE_API
NdrPropertyUniquePtrVec 
GetShaderProperties (const UsdShadeConnectableAPI &shaderDef)
 Gets all input and output properties of the given shaderDef and translates them into NdrProperties that can be used as the properties for an SdrShaderNode. More...
 
static USDSHADE_API std::string GetPrimvarNamesMetadataString (const NdrTokenMap metadata, const UsdShadeConnectableAPI &shaderDef)
 Collects all the names of valid primvar inputs of the given metadata and the given shaderDef and returns the string used to represent them in SdrShaderNode metadata. More...
 

Detailed Description

This class contains a set of utility functions used for populating the shader registry with shaders definitions specified using UsdShade schemas.

Definition at line 44 of file shaderDefUtils.h.

Member Function Documentation

static USDSHADE_API NdrNodeDiscoveryResultVec GetNodeDiscoveryResults ( const UsdShadeShader shaderDef,
const std::string &  sourceUri 
)
static

Returns the list of NdrNodeDiscoveryResult objects that must be added to the shader registry for the given shader shaderDef, assuming it is found in a shader definition file found by an Ndr discovery plugin.

To enable the shaderDef parser to find and parse this shader, sourceUri should have the resolved path to the usd file containing this shader prim.

static USDSHADE_API std::string GetPrimvarNamesMetadataString ( const NdrTokenMap  metadata,
const UsdShadeConnectableAPI shaderDef 
)
static

Collects all the names of valid primvar inputs of the given metadata and the given shaderDef and returns the string used to represent them in SdrShaderNode metadata.

static USDSHADE_API NdrPropertyUniquePtrVec GetShaderProperties ( const UsdShadeConnectableAPI shaderDef)
static

Gets all input and output properties of the given shaderDef and translates them into NdrProperties that can be used as the properties for an SdrShaderNode.

static USDSHADE_API bool SplitShaderIdentifier ( const TfToken identifier,
TfToken familyName,
TfToken implementationName,
NdrVersion *  version 
)
static

Given a shader's identifier token, computes the corresponding SdrShaderNode's family name, implementation name and shader version (as NdrVersion).

  • familyName is the prefix of identifier up to and not including the first underscore.
  • version is the suffix of identifier comprised of one or two integers representing the major and minor version numbers.
  • implementationName is the string we get by joining familyName with everything that's in between familyName and version with an underscore.

Returns true if identifier is valid and was successfully split into the different components.

Note
The python version of this function returns a tuple containing (famiyName, implementationName, version).

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