![]() |
|
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 SdrTokenMap &metadata, const SdrTokenMap &hints, const SdrOptionVec &options) |
| 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. | |
| SDR_API const SdrTokenMap & | GetMetadata () 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 | _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 95 of file shaderProperty.h.
|
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 154 of file shaderProperty.h.
|
inline |
Gets this property's default value associated with the type of the property.
Definition at line 131 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 327 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 211 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 190 of file shaderProperty.h.
|
inline |
All of the metadata that came from the parse process.
Definition at line 184 of file shaderProperty.h.
|
inline |
Gets the name of the property.
Definition at line 120 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 217 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 200 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 166 of file shaderProperty.h.
|
inline |
Gets the type of the property.
Definition at line 124 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 290 of file shaderProperty.h.
|
inline |
If this field is part of a vstruct, this is the conditional expression.
Definition at line 269 of file shaderProperty.h.
|
inline |
If this field is part of a vstruct, this is its name in the struct.
Definition at line 254 of file shaderProperty.h.
|
inline |
If this field is part of a vstruct, this is the name of the struct.
Definition at line 248 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 206 of file shaderProperty.h.
|
inline |
Whether this property's type is an array type.
Definition at line 139 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().
Definition at line 283 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 143 of file shaderProperty.h.
|
inline |
Whether this property is an output.
Definition at line 135 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 378 of file shaderProperty.h.
|
protected |
Definition at line 376 of file shaderProperty.h.
|
protected |
Definition at line 386 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 377 of file shaderProperty.h.
|
protected |
Definition at line 391 of file shaderProperty.h.
|
protected |
Definition at line 382 of file shaderProperty.h.
|
protected |
Definition at line 374 of file shaderProperty.h.
|
protected |
Definition at line 387 of file shaderProperty.h.
|
protected |
Definition at line 392 of file shaderProperty.h.
|
protected |
Definition at line 398 of file shaderProperty.h.
|
protected |
Definition at line 379 of file shaderProperty.h.
|
protected |
Definition at line 375 of file shaderProperty.h.
|
protected |
Definition at line 402 of file shaderProperty.h.
|
protected |
Definition at line 390 of file shaderProperty.h.
|
protected |
Definition at line 396 of file shaderProperty.h.
|
protected |
Definition at line 395 of file shaderProperty.h.
|
protected |
Definition at line 394 of file shaderProperty.h.
|
protected |
Definition at line 393 of file shaderProperty.h.