Loading...
Searching...
No Matches
SdrShaderPropertyMetadata Class Reference

SdrShaderPropertyMetadata contains generic and named metadata for SdrShaderProperty. More...

#include <shaderPropertyMetadata.h>

Public Member Functions

SDR_API SdrShaderPropertyMetadata (const SdrTokenMap &legacyMetadata)
 Ingest metadata from the legacy SdrTokenMap structure.
 
 SdrShaderPropertyMetadata (const std::initializer_list< std::pair< TfToken, std::string > > &init)
 Ingest metadata from an initializer list for the legacy SdrTokenMap.
 
 SdrShaderPropertyMetadata (const VtDictionary &items)
 
 SdrShaderPropertyMetadata (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 HasHelp () const
 
SDR_API std::string GetHelp () const
 
SDR_API void SetHelp (const std::string &v)
 
SDR_API void ClearHelp ()
 
SDR_API bool HasPage () const
 
SDR_API TfToken GetPage () const
 
SDR_API void SetPage (const TfToken &v)
 
SDR_API void ClearPage ()
 
SDR_API bool HasRenderType () const
 
SDR_API std::string GetRenderType () const
 
SDR_API void SetRenderType (const std::string &v)
 
SDR_API void ClearRenderType ()
 
SDR_API bool HasRole () const
 
SDR_API std::string GetRole () const
 
SDR_API void SetRole (const std::string &v)
 
SDR_API void ClearRole ()
 
SDR_API bool HasWidget () const
 
SDR_API TfToken GetWidget () const
 
SDR_API void SetWidget (const TfToken &v)
 
SDR_API void ClearWidget ()
 
SDR_API bool HasIsDynamicArray () const
 
SDR_API bool GetIsDynamicArray () const
 
SDR_API void SetIsDynamicArray (const bool &v)
 
SDR_API void ClearIsDynamicArray ()
 
SDR_API bool HasTupleSize () const
 
SDR_API int GetTupleSize () const
 
SDR_API void SetTupleSize (const int &v)
 
SDR_API void ClearTupleSize ()
 
SDR_API bool HasConnectable () const
 
SDR_API bool GetConnectable () const
 
SDR_API void SetConnectable (const bool &v)
 
SDR_API void ClearConnectable ()
 
SDR_API bool HasShownIf () const
 
SDR_API std::string GetShownIf () const
 
SDR_API void SetShownIf (const std::string &v)
 
SDR_API void ClearShownIf ()
 
SDR_API bool HasValidConnectionTypes () const
 
SDR_API SdrTokenVec GetValidConnectionTypes () const
 
SDR_API void SetValidConnectionTypes (const SdrTokenVec &v)
 
SDR_API void ClearValidConnectionTypes ()
 
SDR_API bool HasIsAssetIdentifier () const
 
SDR_API bool GetIsAssetIdentifier () const
 
SDR_API void SetIsAssetIdentifier (const bool &v)
 
SDR_API void ClearIsAssetIdentifier ()
 
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 HasSdrUsdDefinitionType () const
 
SDR_API TfToken GetSdrUsdDefinitionType () const
 
SDR_API void SetSdrUsdDefinitionType (const TfToken &v)
 
SDR_API void ClearSdrUsdDefinitionType ()
 
SDR_API bool HasDefaultInput () const
 
SDR_API bool GetDefaultInput () const
 
SDR_API void SetDefaultInput (const bool &v)
 
SDR_API void ClearDefaultInput ()
 
SDR_API bool HasColorspace () const
 
SDR_API TfToken GetColorspace () const
 
SDR_API void SetColorspace (const TfToken &v)
 
SDR_API void ClearColorspace ()
 

Friends

class SdrShaderProperty
 

Detailed Description

SdrShaderPropertyMetadata contains generic and named metadata for SdrShaderProperty.

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 SdrShaderProperty with SdrShaderProperty::GetMetadataObject

Definition at line 81 of file shaderPropertyMetadata.h.

Constructor & Destructor Documentation

◆ SdrShaderPropertyMetadata() [1/5]

SDR_API SdrShaderPropertyMetadata ( const SdrTokenMap &  legacyMetadata)

Ingest metadata from the legacy SdrTokenMap structure.

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

◆ SdrShaderPropertyMetadata() [2/5]

SdrShaderPropertyMetadata ( 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 SdrShaderProperty constructor.

Definition at line 96 of file shaderPropertyMetadata.h.

◆ SdrShaderPropertyMetadata() [3/5]

SdrShaderPropertyMetadata ( const VtDictionary items)
inlineexplicit

Definition at line 100 of file shaderPropertyMetadata.h.

◆ SdrShaderPropertyMetadata() [4/5]

SdrShaderPropertyMetadata ( VtDictionary &&  items)
inlineexplicit

Definition at line 103 of file shaderPropertyMetadata.h.

◆ SdrShaderPropertyMetadata() [5/5]

Definition at line 106 of file shaderPropertyMetadata.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 164 of file shaderPropertyMetadata.h.

◆ GetItems() [2/2]

const VtDictionary & GetItems ( ) const &
inline

Get all key-value items.

Definition at line 161 of file shaderPropertyMetadata.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 144 of file shaderPropertyMetadata.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.

{@

◆ 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 125 of file shaderPropertyMetadata.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.

Friends And Related Function Documentation

◆ SdrShaderProperty

friend class SdrShaderProperty
friend

Definition at line 317 of file shaderPropertyMetadata.h.


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