![]() |
|
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. | |
| SDR_API | SdrShaderNodeMetadata (const 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 > | |
| 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 VtDictionary & | GetItems () 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 | 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 () |
Category | |
Deprecated metadata item. | |
| SDR_API bool | HasCategory () const |
| SDR_API TfToken | GetCategory () const |
| SDR_API void | SetCategory (const TfToken &v) |
| SDR_API void | ClearCategory () |
Domain | |
Domain defines groups for the broadest system categories. Domain has a default value of "rendering". This means that at SdrShaderNodeMetadata initialization time, unspecified domains will be initialized to SdrNodeDomain->Rendering. SdrNodeDomain contains common domain token values. {@ | |
| SDR_API bool | HasDomain () const |
| SDR_API TfToken | GetDomain () const |
| SDR_API void | SetDomain (const TfToken &v) |
| SDR_API void | ClearDomain () |
Subdomain | |
Subdomain defines subsystems within the domain. SdrNodeSubdomain contains common subdomain token values. {@ | |
| SDR_API bool | HasSubdomain () const |
| SDR_API TfToken | GetSubdomain () const |
| SDR_API void | SetSubdomain (const TfToken &v) |
| SDR_API void | ClearSubdomain () |
Context | |
Context describes a node's usage group within its subdomain. SdrNodeContext contains common context token values. {@ | |
| SDR_API bool | HasContext () const |
| SDR_API TfToken | GetContext () const |
| SDR_API void | SetContext (const TfToken &v) |
| SDR_API void | ClearContext () |
Role | |
Role provides finer granularity for contexts that contain many nodes. {@ | |
| SDR_API bool | HasRole () const |
| SDR_API TfToken | GetRole () const |
| SDR_API void | SetRole (const TfToken &v) |
| SDR_API void | ClearRole () |
Target Renderer | |
When set, the target renderer item describes that a node was designed for (but not necessarily limited to) a specific renderer. For example, if a node sets its target renderer to "FooRenderer", "BarRenderer" may still be able render the node partially, although this isn't guaranteed. "BarRenderer" can check the node's target renderer in addition to the node's shadingSystem for compatibility hints. If a node's target renderer is unspecified, renderers should rely on a node's shadingSystem as usual to determine compatibility. {@ | |
| SDR_API bool | HasTargetRenderer () const |
| SDR_API TfToken | GetTargetRenderer () const |
| SDR_API void | SetTargetRenderer (const TfToken &v) |
| SDR_API void | ClearTargetRenderer () |
Collections | |
Collections provides a way to group nodes across different categories in the domain-subdomain-context-role-function hierarchy. For example, a parser plugin author may decide that all lama nodes should have "lama" in its Collections metadata. Or that all nodes that have something to do with subsurface scattering be annotated with a "subsurface" collection. {@ | |
| SDR_API bool | HasCollections () const |
| SDR_API SdrTokenVec | GetCollections () const |
| SDR_API void | SetCollections (const SdrTokenVec &v) |
| SDR_API void | ClearCollections () |
Departments | |
Deprecated metadata item. | |
| SDR_API bool | HasDepartments () const |
| SDR_API SdrTokenVec | GetDepartments () const |
| SDR_API void | SetDepartments (const SdrTokenVec &v) |
| SDR_API void | ClearDepartments () |
PagesShownIf | |
PagesShownIf is encoded as an SdrTokenMap, where each key is a page name and each value is a "shownIf" style expression.
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 () |
Static Public Member Functions | |
Default values | |
Default values are populated to SdrShaderNodeMetadata at construction time, if the corresponding metadata items are not already specified by the ingested dictionary. Note that metadata items with default values can still be modified post-construction, and that clearing those items will remove them from the metadata object rather than resetting them to their default value. {@ | |
| static SDR_API VtValue | GetDefaultValue (const TfToken &key) |
| This method returns a non-empty VtValue if and only if the key represents a metadata item with a default value. | |
| static SDR_API const VtDictionary & | GetDefaultValues () |
| Returns all metadata items that have default values. | |
Friends | |
| class | SdrShaderNode |
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 106 of file shaderNodeMetadata.h.
| 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.
|
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 124 of file shaderNodeMetadata.h.
| SDR_API void ClearCategory | ( | ) |
| SDR_API void ClearDepartments | ( | ) |
| SDR_API void ClearItem | ( | const TfToken & | key | ) |
Clear the metadata item for the given key if it exists.
| SDR_API void ClearPages | ( | ) |
| SDR_API TfToken GetCategory | ( | ) | const |
This method returns a non-empty VtValue if and only if the key represents a metadata item with a default value.
|
static |
Returns all metadata items that have default values.
The result is a dictionary with metadata keys and their associated default values.
| SDR_API SdrTokenVec GetDepartments | ( | ) | const |
|
inline |
Get all key-value items by-value.
Definition at line 190 of file shaderNodeMetadata.h.
|
inline |
Get all key-value items.
Definition at line 187 of file shaderNodeMetadata.h.
|
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 170 of file shaderNodeMetadata.h.
| SDR_API SdrTokenVec GetPages | ( | ) | const |
| SDR_API bool HasCategory | ( | ) | const |
| SDR_API bool HasDepartments | ( | ) | const |
| SDR_API bool HasItem | ( | const TfToken & | key | ) | const |
Returns whether this metadata contains an item with the given key.
| SDR_API bool HasLabel | ( | ) | const |
Named metadata.
{@
| SDR_API bool HasPages | ( | ) | const |
SdrShaderNode::GetPages is computed via SdrShaderProperty's Pages metadata. The Pages node metadata API is redundant and therefore deprecated.
{@
| SDR_API void SetCategory | ( | const TfToken & | v | ) |
| SDR_API void SetDepartments | ( | const SdrTokenVec & | v | ) |
|
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 151 of file shaderNodeMetadata.h.
Set a key-value item for this metadata.
If the key-value item already exists, it will be overwritten by the provided arguments.
Clears the item if given an empty VtValue.
Issues a TF_CODING_ERROR if the key is in "named metadata" and the value's contained type does not match the type registered by the named metadata item. In this case, no action is taken to set the item.
| SDR_API void SetPages | ( | const SdrTokenVec & | v | ) |
|
friend |
Definition at line 479 of file shaderNodeMetadata.h.