Loading...
Searching...
No Matches
SdrShaderNodeMetadata Class Reference

SdrShaderNodeMetadata contains generic and named metadata for SdrShaderNode. More...

#include <shaderNodeMetadata.h>

Public Member Functions

SDR_API SdrShaderNodeMetadata (const SdrTokenMap &legacyMetadata)
 Ingest metadata from the legacy SdrTokenMap structure.
 
 SdrShaderNodeMetadata (const std::initializer_list< std::pair< TfToken, std::string > > &init)
 Ingest metadata from an initializer list for the legacy SdrTokenMap.
 
 SdrShaderNodeMetadata (const VtDictionary &items)
 
 SdrShaderNodeMetadata (VtDictionary &&items)
 
SDR_API bool HasItem (const TfToken &key) const
 Returns whether this metadata contains an item with the given key.
 
SDR_API void SetItem (const TfToken &key, const VtValue &value)
 Set a key-value item for this metadata.
 
template<typename T >
void SetItem (const TfToken &key, const T &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SDR_API VtValue GetItemValue (const TfToken &key) const
 Get the VtValue for the given key.
 
template<typename T >
GetItemValueAs (const TfToken &key) const
 Convenience to get an item value as T.
 
SDR_API void ClearItem (const TfToken &key)
 Clear the metadata item for the given key if it exists.
 
const VtDictionaryGetItems () const &
 Get all key-value items.
 
VtDictionary GetItems () &&
 Get all key-value items by-value.
 
SDR_API bool HasLabel () const
 Named metadata.
 
SDR_API TfToken GetLabel () const
 
SDR_API void SetLabel (const TfToken &v)
 
SDR_API void ClearLabel ()
 
SDR_API bool HasCategory () const
 
SDR_API TfToken GetCategory () const
 
SDR_API void SetCategory (const TfToken &v)
 
SDR_API void ClearCategory ()
 
SDR_API bool HasHelp () const
 
SDR_API std::string GetHelp () const
 
SDR_API void SetHelp (const std::string &v)
 
SDR_API void ClearHelp ()
 
SDR_API bool HasDepartments () const
 
SDR_API SdrTokenVec GetDepartments () const
 
SDR_API void SetDepartments (const SdrTokenVec &v)
 
SDR_API void ClearDepartments ()
 
SDR_API bool HasPages () const
 
SDR_API SdrTokenVec GetPages () const
 
SDR_API void SetPages (const SdrTokenVec &v)
 
SDR_API void ClearPages ()
 
SDR_API bool HasOpenPages () const
 
SDR_API SdrTokenVec GetOpenPages () const
 
SDR_API void SetOpenPages (const SdrTokenVec &v)
 
SDR_API void ClearOpenPages ()
 
SDR_API bool HasPrimvars () const
 
SDR_API SdrStringVec GetPrimvars () const
 
SDR_API void SetPrimvars (const SdrStringVec &v)
 
SDR_API void ClearPrimvars ()
 
SDR_API bool HasImplementationName () const
 
SDR_API std::string GetImplementationName () const
 
SDR_API void SetImplementationName (const std::string &v)
 
SDR_API void ClearImplementationName ()
 
SDR_API bool HasSdrUsdEncodingVersion () const
 
SDR_API int GetSdrUsdEncodingVersion () const
 
SDR_API void SetSdrUsdEncodingVersion (const int &v)
 
SDR_API void ClearSdrUsdEncodingVersion ()
 
SDR_API bool HasSdrDefinitionNameFallbackPrefix () const
 
SDR_API std::string GetSdrDefinitionNameFallbackPrefix () const
 
SDR_API void SetSdrDefinitionNameFallbackPrefix (const std::string &v)
 
SDR_API void ClearSdrDefinitionNameFallbackPrefix ()
 
Role

Role is used to annotate the role that the shader node plays inside a shader network.

An empty Token value for Role indicates non-existence of Role metadata; this is a disallowed state for Role.

See also
SetRole

The "empty Token value" non-existence criterion is in addition to the usual metadata non-existence criteria. {@

SDR_API bool HasRole () const
 
SDR_API TfToken GetRole () const
 
SDR_API void SetRole (const TfToken &v)
 Sets the given Role value.
 
SDR_API void ClearRole ()
 
PagesShownIf

PagesShownIf is encoded as an SdrTokenMap, where each key is a page name and each value is a "shownIf" style expression.

See also
SdrShaderProperty::GetShownIf

A nested page may be represented with ":" separating subpages.

{@

SDR_API bool HasPagesShownIf () const
 
SDR_API SdrTokenMap GetPagesShownIf () const
 
SDR_API void SetPagesShownIf (const SdrTokenMap &v)
 
SDR_API void ClearPagesShownIf ()
 

Friends

class SdrShaderNode
 

Detailed Description

SdrShaderNodeMetadata contains generic and named metadata for SdrShaderNode.

Named metadata are key-value items that are standardized and documented for interchange. Named metadata items are defined to have certain types that expect certain encodings. The Has/Set/Get methods for named key-value items provide views into the requested metadata item's unpacked VtValues.

NOTE: This metadata is retrievable from SdrShaderNode with SdrShaderNode::GetMetadataObject

Definition at line 78 of file shaderNodeMetadata.h.

Constructor & Destructor Documentation

◆ SdrShaderNodeMetadata() [1/5]

SDR_API SdrShaderNodeMetadata ( const SdrTokenMap &  legacyMetadata)

Ingest metadata from the legacy SdrTokenMap structure.

For named metadata items, conversions to richer types from the SdrTokenMap values are attempted.

◆ SdrShaderNodeMetadata() [2/5]

SdrShaderNodeMetadata ( const std::initializer_list< std::pair< TfToken, std::string > > &  init)
inline

Ingest metadata from an initializer list for the legacy SdrTokenMap.

This helps provide automatic, implicit backwards compatibility for users that construct SdrTokenMap metadata via an initializer list in the SdrShaderNode constructor.

Definition at line 93 of file shaderNodeMetadata.h.

◆ SdrShaderNodeMetadata() [3/5]

SdrShaderNodeMetadata ( const VtDictionary items)
inlineexplicit

Definition at line 97 of file shaderNodeMetadata.h.

◆ SdrShaderNodeMetadata() [4/5]

SdrShaderNodeMetadata ( VtDictionary &&  items)
inlineexplicit

Definition at line 100 of file shaderNodeMetadata.h.

◆ SdrShaderNodeMetadata() [5/5]

Definition at line 103 of file shaderNodeMetadata.h.

Member Function Documentation

◆ ClearItem()

SDR_API void ClearItem ( const TfToken key)

Clear the metadata item for the given key if it exists.

◆ GetItems() [1/2]

VtDictionary GetItems ( ) &&
inline

Get all key-value items by-value.

Definition at line 161 of file shaderNodeMetadata.h.

◆ GetItems() [2/2]

const VtDictionary & GetItems ( ) const &
inline

Get all key-value items.

Definition at line 158 of file shaderNodeMetadata.h.

◆ GetItemValue()

SDR_API VtValue GetItemValue ( const TfToken key) const

Get the VtValue for the given key.

If the value is found in the legacy SdrTokenMap metadata, the returned value will be a VtValue holding std::string.

If a key-value item doesn't exist for the given key in this metadata, returns an empty VtValue.

◆ GetItemValueAs()

T GetItemValueAs ( const TfToken key) const
inline

Convenience to get an item value as T.

If any value fails conversion or doesn't exist in the metadata, a default constructed value for T is returned.

Definition at line 141 of file shaderNodeMetadata.h.

◆ HasItem()

SDR_API bool HasItem ( const TfToken key) const

Returns whether this metadata contains an item with the given key.

◆ HasLabel()

SDR_API bool HasLabel ( ) const

Named metadata.

{@

◆ HasPages()

SDR_API bool HasPages ( ) const
Deprecated:

SdrShaderNode::GetPages is computed via SdrShaderProperty's Pages metadata. The Pages node metadata API is redundant and therefore deprecated.

{@

◆ SetItem() [1/2]

void SetItem ( const TfToken key,
const T &  value 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 122 of file shaderNodeMetadata.h.

◆ SetItem() [2/2]

SDR_API void SetItem ( const TfToken key,
const VtValue value 
)

Set a key-value item for this metadata.

If the key-value item already exists, it will be overwritten by the provided arguments.

Issues a TF_CODING_ERROR if the value is empty or if the key is in "named metadata" and the value's contained type does not match the type registered by the named metadata item.

◆ SetRole()

SDR_API void SetRole ( const TfToken v)

Sets the given Role value.

If given an empty string, clears the Role item.

Friends And Related Function Documentation

◆ SdrShaderNode

friend class SdrShaderNode
friend

Definition at line 314 of file shaderNodeMetadata.h.


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