Loading...
Searching...
No Matches
ShaderMetadataHelpers Namespace Reference

Various utilities for parsing metadata contained within shaders. More...

Functions

SDR_API bool IsTruthy (const TfToken &key, const NdrTokenMap &metadata)
 Determines if the given metadatum in the metadata dictionary has a truthy value.
 
SDR_API std::string StringVal (const TfToken &key, const NdrTokenMap &metadata, const std::string &defaultValue=std::string())
 Extracts the string value from the given metadatum if it exists, otherwise returns defaultValue.
 
SDR_API TfToken TokenVal (const TfToken &key, const NdrTokenMap &metadata, const TfToken &defaultValue=TfToken())
 Extracts the tokenized value from the given metadatum if it exists, otherwise returns defaultValue.
 
SDR_API int IntVal (const TfToken &key, const NdrTokenMap &metadata, int defaultValue=std::numeric_limits< int >::max())
 Extracts the int value from the given metadatum if it exists and is a valid integer value, otherwise returns default value.
 
SDR_API NdrStringVec StringVecVal (const TfToken &key, const NdrTokenMap &metadata)
 Extracts a vector of strings from the given metadatum.
 
SDR_API NdrTokenVec TokenVecVal (const TfToken &key, const NdrTokenMap &metadata)
 Extracts a vector of tokenized values from the given metadatum.
 
SDR_API NdrOptionVec OptionVecVal (const std::string &optionStr)
 Extracts an "options" vector from the given string.
 
SDR_API std::string CreateStringFromStringVec (const NdrStringVec &stringVec)
 Serializes a vector of strings into a string using the pipe character as the delimiter.
 
SDR_API bool IsPropertyAnAssetIdentifier (const NdrTokenMap &metadata)
 Determines if the specified property metadata has a widget that indicates the property is an asset identifier.
 
SDR_API bool IsPropertyATerminal (const NdrTokenMap &metadata)
 Determines if the specified property metadata has a 'renderType' that indicates the property should be a SdrPropertyTypes->Terminal.
 
SDR_API TfToken GetRoleFromMetadata (const NdrTokenMap &metadata)
 Gets the "role" from metadata if one is provided. Only returns a value.
 

Detailed Description

Various utilities for parsing metadata contained within shaders.

Function Documentation

◆ CreateStringFromStringVec()

SDR_API std::string CreateStringFromStringVec ( const NdrStringVec &  stringVec)

Serializes a vector of strings into a string using the pipe character as the delimiter.

◆ GetRoleFromMetadata()

SDR_API TfToken GetRoleFromMetadata ( const NdrTokenMap &  metadata)

Gets the "role" from metadata if one is provided. Only returns a value.

◆ IntVal()

SDR_API int IntVal ( const TfToken key,
const NdrTokenMap &  metadata,
int  defaultValue = std::numeric_limits< int >::max() 
)

Extracts the int value from the given metadatum if it exists and is a valid integer value, otherwise returns default value.

◆ IsPropertyAnAssetIdentifier()

SDR_API bool IsPropertyAnAssetIdentifier ( const NdrTokenMap &  metadata)

Determines if the specified property metadata has a widget that indicates the property is an asset identifier.

◆ IsPropertyATerminal()

SDR_API bool IsPropertyATerminal ( const NdrTokenMap &  metadata)

Determines if the specified property metadata has a 'renderType' that indicates the property should be a SdrPropertyTypes->Terminal.

◆ IsTruthy()

SDR_API bool IsTruthy ( const TfToken key,
const NdrTokenMap &  metadata 
)

Determines if the given metadatum in the metadata dictionary has a truthy value.

All values are considered to be true except the following (case-insensitive): '0', 'false', and 'f'. The absence of key in the metadata also evaluates to false.

◆ OptionVecVal()

SDR_API NdrOptionVec OptionVecVal ( const std::string &  optionStr)

Extracts an "options" vector from the given string.

◆ StringVal()

SDR_API std::string StringVal ( const TfToken key,
const NdrTokenMap &  metadata,
const std::string &  defaultValue = std::string() 
)

Extracts the string value from the given metadatum if it exists, otherwise returns defaultValue.

◆ StringVecVal()

SDR_API NdrStringVec StringVecVal ( const TfToken key,
const NdrTokenMap &  metadata 
)

Extracts a vector of strings from the given metadatum.

An empty vector is returned if the metadatum does not exist.

◆ TokenVal()

SDR_API TfToken TokenVal ( const TfToken key,
const NdrTokenMap &  metadata,
const TfToken defaultValue = TfToken() 
)

Extracts the tokenized value from the given metadatum if it exists, otherwise returns defaultValue.

◆ TokenVecVal()

SDR_API NdrTokenVec TokenVecVal ( const TfToken key,
const NdrTokenMap &  metadata 
)

Extracts a vector of tokenized values from the given metadatum.

An empty vector is returned if the metadatum does not exist.