![]() |
|
Represents a property (input or output) that is part of a SdrShaderNode instance.
More...
#include <shaderProperty.h>
Public Member Functions | |
| SDR_API | SdrShaderProperty (const TfToken &name, const TfToken &type, const VtValue &defaultValue, bool isOutput, size_t arraySize, const SdrShaderPropertyMetadata &metadata, const SdrTokenMap &hints, const SdrOptionVec &options) |
| Constructor. | |
| virtual SDR_API | ~SdrShaderProperty () |
| Destructor. | |
The Basics | |
| SDR_API const TfToken & | GetName () const |
| Gets the name of the property. | |
| SDR_API const TfToken & | GetType () const |
| Gets the type of the property. | |
| SDR_API const VtValue & | GetDefaultValue () const |
| Gets this property's default value associated with the type of the property. | |
| SDR_API bool | IsOutput () const |
| Whether this property is an output. | |
| SDR_API bool | IsArray () const |
| Whether this property's type is an array type. | |
| SDR_API bool | IsDynamicArray () const |
| Whether this property's array type is dynamically-sized. | |
| SDR_API int | GetArraySize () const |
| Gets this property's array size. | |
| SDR_API int | GetTupleSize () const |
| Gets this property's tuple size. | |
| SDR_API std::string | GetInfoString () const |
| Gets a string with basic information about this property. | |
Metadata | |
The metadata returned here is a direct result of what the parser plugin is able to determine about the property. See the documentation for a specific parser plugin to get help on what the parser is looking for to populate these values. | |
| const SdrTokenMap & | GetMetadata () const |
| All of the metadata that came from the parse process. | |
| const SdrShaderPropertyMetadata & | GetMetadataObject () const |
| All of the metadata that came from the parse process. | |
| SDR_API const TfToken & | GetLabel () const |
| The label assigned to this property, if any. | |
| SDR_API std::string | GetHelp () const |
| The help message assigned to this property, if any. | |
| SDR_API const TfToken & | GetPage () const |
| The page (group), eg "Advanced", this property appears on, if any. | |
| SDR_API const TfToken & | GetWidget () const |
| The widget "hint" that indicates the widget that can best display the type of data contained in this property, if any. | |
| SDR_API const SdrTokenMap & | GetHints () const |
| Any UI "hints" that are associated with this property. | |
| SDR_API const SdrOptionVec & | GetOptions () const |
| If the property has a set of valid values that are pre-determined, this will return the valid option names and corresponding string values (if the option was specified with a value). | |
| SDR_API std::string | GetImplementationName () const |
| Returns the implementation name of this property. | |
| SDR_API std::string | GetShownIf () const |
A boolean expression (SdfBooleanExpression) that determines if the property should be shown in the UI based on the state of other properties of the same node. | |
VStruct Information | |
| SDR_API const TfToken & | GetVStructMemberOf () const |
| If this field is part of a vstruct, this is the name of the struct. | |
| SDR_API const TfToken & | GetVStructMemberName () const |
| If this field is part of a vstruct, this is its name in the struct. | |
| SDR_API bool | IsVStructMember () const |
| Returns true if this field is part of a vstruct. | |
| SDR_API bool | IsVStruct () const |
| Returns true if the field is the head of a vstruct. | |
| SDR_API const TfToken & | GetVStructConditionalExpr () const |
| If this field is part of a vstruct, this is the conditional expression. | |
Connection Information | |
| SDR_API bool | IsConnectable () const |
| Whether this property can be connected to other properties. | |
| SDR_API const SdrTokenVec & | GetValidConnectionTypes () const |
| Gets the list of valid connection types for this property. | |
| SDR_API bool | CanConnectTo (const SdrShaderProperty &other) const |
| Determines if this property can be connected to the specified property. | |
Utilities | |
| SDR_API SdrSdfTypeIndicator | GetTypeAsSdfType () const |
Converts the property's type from GetType() into a SdrSdfTypeIndicator. | |
| SDR_API const VtValue & | GetDefaultValueAsSdfType () const |
| Accessor for default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType. | |
| SDR_API bool | IsAssetIdentifier () const |
| Determines if the value held by this property is an asset identifier (eg, a file path); the logic for this is left up to the parser. | |
| SDR_API bool | IsDefaultInput () const |
| Determines if the value held by this property is the default input for this node. | |
Protected Member Functions | |
| SdrShaderProperty & | operator= (const SdrShaderProperty &)=delete |
| void | _SetUsdEncodingVersion (int usdEncodingVersion) |
| void | _ConvertToVStruct () |
| void | _ConvertExpressions (const SdrShaderPropertyUniquePtrVec &properties, SdrShaderNodeConstPtr shader) |
| void | _FinalizeProperty () |
Protected Attributes | |
| TfToken | _name |
| TfToken | _type |
| VtValue | _defaultValue |
| bool | _isOutput |
| size_t | _arraySize |
| size_t | _tupleSize |
| bool | _isDynamicArray |
| bool | _isConnectable |
| SdrTokenMap | _legacyMetadata |
| SdrShaderPropertyMetadata | _metadata |
| const SdrTokenMap | _hints |
| const SdrOptionVec | _options |
| SdrTokenVec | _validConnectionTypes |
| TfToken | _label |
| TfToken | _page |
| TfToken | _widget |
| TfToken | _vstructMemberOf |
| TfToken | _vstructMemberName |
| TfToken | _vstructConditionalExpr |
| VtValue | _sdfTypeDefaultValue |
| int | _usdEncodingVersion |
Friends | |
| void | SdrShaderNode::_PostProcessProperties () |
Represents a property (input or output) that is part of a SdrShaderNode instance.
A property must have a name and type, but may also specify a host of additional metadata. Instances can also be queried to determine if another SdrShaderProperty instance can be connected to it.
Definition at line 56 of file shaderProperty.h.
| SDR_API SdrShaderProperty | ( | const TfToken & | name, |
| const TfToken & | type, | ||
| const VtValue & | defaultValue, | ||
| bool | isOutput, | ||
| size_t | arraySize, | ||
| const SdrShaderPropertyMetadata & | metadata, | ||
| const SdrTokenMap & | hints, | ||
| const SdrOptionVec & | options | ||
| ) |
Constructor.
SdrTokenMap as metadata is deprecated in favor of the constructor taking SdrShaderPropertyMetadata. Note that SdrShaderPropertyMetadata has an implicit constructor from the legacy SdrTokenMap metadata.
|
virtual |
Destructor.
| SDR_API bool CanConnectTo | ( | const SdrShaderProperty & | other | ) | const |
Determines if this property can be connected to the specified property.
|
inline |
Gets this property's array size.
If this property is a fixed-size array type, the array size is returned. In the case of a dynamically-sized array, this method returns the array size that the parser reports, and should not be relied upon to be accurate. A parser may report -1 for the array size, for example, to indicate a dynamically-sized array. For types that are not a fixed-size array or dynamic array, this returns 0.
Definition at line 123 of file shaderProperty.h.
|
inline |
Gets this property's default value associated with the type of the property.
Definition at line 100 of file shaderProperty.h.
|
inline |
Accessor for default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.
Note that this is different than GetDefaultValue which returns the default value associated with the SdrPropertyType and may differ from the SdfValueTypeName, example when sdrUsdDefinitionType metadata is specified for a sdr property.
Definition at line 312 of file shaderProperty.h.
| SDR_API std::string GetHelp | ( | ) | const |
The help message assigned to this property, if any.
|
inline |
Any UI "hints" that are associated with this property.
"Hints" are simple key/value pairs.
Definition at line 192 of file shaderProperty.h.
| SDR_API std::string GetImplementationName | ( | ) | const |
Returns the implementation name of this property.
The name of the property is how to refer to the property in shader networks. The label is how to present this property to users. The implementation name is the name of the parameter this property represents in the implementation. Any client using the implementation must call this method to get the correct name; using getName() is not correct.
| SDR_API std::string GetInfoString | ( | ) | const |
Gets a string with basic information about this property.
Helpful for things like adding this property to a log.
|
inline |
The label assigned to this property, if any.
Distinct from the name returned from GetName(). In the context of a UI, the label value might be used as the display name for the property instead of the name.
Definition at line 171 of file shaderProperty.h.
|
inline |
All of the metadata that came from the parse process.
If this property was initialized with the upgraded SdrShaderPropertyMetadata class, the legacy metadata returned by this function will contain only string representations of named metadata, and any other metadata items whose value holds a string type in SdrShaderNodeMetadata. Other metadata items may be omitted.
Definition at line 160 of file shaderProperty.h.
|
inline |
All of the metadata that came from the parse process.
Definition at line 163 of file shaderProperty.h.
|
inline |
Gets the name of the property.
Definition at line 89 of file shaderProperty.h.
|
inline |
If the property has a set of valid values that are pre-determined, this will return the valid option names and corresponding string values (if the option was specified with a value).
Definition at line 198 of file shaderProperty.h.
|
inline |
The page (group), eg "Advanced", this property appears on, if any.
Note that the page for a shader property can be nested, delimited by ":", representing the hierarchy of sub-pages a property is defined in.
Definition at line 181 of file shaderProperty.h.
| SDR_API std::string GetShownIf | ( | ) | const |
A boolean expression (SdfBooleanExpression) that determines if the property should be shown in the UI based on the state of other properties of the same node.
If an expression is not provided for SdrPropertyMetadata->ShownIf and the property instead contains conditional visibility metadata expressed in the style of Katana "args" files, an attempt will be made to convert the condition into an SdfBooleanExpression-style boolean expression.
|
inline |
Gets this property's tuple size.
The tuple size indicates an array's "column count", or how many elements it takes to form a logical row. For non-dynamic arrays, the array size should be a multiple of the tuple size.
If no tuple size is specified, returns 0.
Definition at line 135 of file shaderProperty.h.
|
inline |
Gets the type of the property.
Definition at line 93 of file shaderProperty.h.
| SDR_API SdrSdfTypeIndicator GetTypeAsSdfType | ( | ) | const |
Converts the property's type from GetType() into a SdrSdfTypeIndicator.
Two scenarios can result: an exact mapping from property type to Sdf type, and an inexact mapping. In the first scenario, SdrSdfTypeIndicator will contain a cleanly-mapped Sdf type. In the second scenario, the SdrSdfTypeIndicator will contain an Sdf type set to Token to indicate an unclean mapping, and SdrSdfTypeIndicator::GetSdrType will be set to the original type returned by GetType().
|
inline |
Gets the list of valid connection types for this property.
This value comes from shader metadata, and may not be specified. The value from SdrShaderProperty::GetType() can be used as a fallback, or you can use the connectability test in CanConnectTo().
Definition at line 275 of file shaderProperty.h.
|
inline |
If this field is part of a vstruct, this is the conditional expression.
Definition at line 250 of file shaderProperty.h.
|
inline |
If this field is part of a vstruct, this is its name in the struct.
Definition at line 235 of file shaderProperty.h.
|
inline |
If this field is part of a vstruct, this is the name of the struct.
Definition at line 229 of file shaderProperty.h.
|
inline |
The widget "hint" that indicates the widget that can best display the type of data contained in this property, if any.
Examples of this value could include "number", "slider", etc.
Definition at line 187 of file shaderProperty.h.
|
inline |
Whether this property's type is an array type.
Definition at line 108 of file shaderProperty.h.
| SDR_API bool IsAssetIdentifier | ( | ) | const |
Determines if the value held by this property is an asset identifier (eg, a file path); the logic for this is left up to the parser.
Note: The type returned from GetTypeAsSdfType() will be Asset if this method returns true (even though its true underlying data type is string).
|
inline |
Whether this property can be connected to other properties.
If this returns true, connectability to a specific property can be tested via CanConnectTo().
Properties are by default connectable – note that when SdrShaderPropertyMetadata::HasConnectable is false, this method SdrShaderProperty::IsConnectable will return true.
Definition at line 268 of file shaderProperty.h.
| SDR_API bool IsDefaultInput | ( | ) | const |
Determines if the value held by this property is the default input for this node.
|
inline |
Whether this property's array type is dynamically-sized.
Definition at line 112 of file shaderProperty.h.
|
inline |
Whether this property is an output.
Definition at line 104 of file shaderProperty.h.
| SDR_API bool IsVStruct | ( | ) | const |
Returns true if the field is the head of a vstruct.
| SDR_API bool IsVStructMember | ( | ) | const |
Returns true if this field is part of a vstruct.
|
protected |
Definition at line 363 of file shaderProperty.h.
|
protected |
Definition at line 361 of file shaderProperty.h.
|
protected |
Definition at line 372 of file shaderProperty.h.
|
protected |
Definition at line 366 of file shaderProperty.h.
|
protected |
Definition at line 365 of file shaderProperty.h.
|
protected |
Definition at line 362 of file shaderProperty.h.
|
protected |
Definition at line 377 of file shaderProperty.h.
|
protected |
Definition at line 367 of file shaderProperty.h.
|
protected |
Definition at line 368 of file shaderProperty.h.
|
protected |
Definition at line 359 of file shaderProperty.h.
|
protected |
Definition at line 373 of file shaderProperty.h.
|
protected |
Definition at line 378 of file shaderProperty.h.
|
protected |
Definition at line 384 of file shaderProperty.h.
|
protected |
Definition at line 364 of file shaderProperty.h.
|
protected |
Definition at line 360 of file shaderProperty.h.
|
protected |
Definition at line 388 of file shaderProperty.h.
|
protected |
Definition at line 376 of file shaderProperty.h.
|
protected |
Definition at line 382 of file shaderProperty.h.
|
protected |
Definition at line 381 of file shaderProperty.h.
|
protected |
Definition at line 380 of file shaderProperty.h.
|
protected |
Definition at line 379 of file shaderProperty.h.