8#ifndef PXR_USD_SDR_SHADER_PROPERTY_H
9#define PXR_USD_SDR_SHADER_PROPERTY_H
17#include "pxr/base/vt/value.h"
18#include "pxr/usd/sdf/booleanExpression.h"
19#include "pxr/usd/sdr/api.h"
24PXR_NAMESPACE_OPEN_SCOPE
28#define SDR_PROPERTY_TYPE_TOKENS \
30 ((String, "string")) \
33 ((Color4, "color4")) \
35 ((Normal, "normal")) \
36 ((Vector, "vector")) \
37 ((Matrix, "matrix")) \
38 ((Struct, "struct")) \
39 ((Terminal, "terminal")) \
40 ((Vstruct, "vstruct")) \
41 ((Unknown, "unknown"))
46#define SDR_PROPERTY_METADATA_TOKENS \
50 ((RenderType, "renderType")) \
52 ((Widget, "widget")) \
54 ((Options, "options")) \
55 ((IsDynamicArray, "isDynamicArray")) \
56 ((TupleSize, "tupleSize")) \
57 ((Connectable, "connectable")) \
59 ((ShownIf, "shownIf")) \
60 ((ValidConnectionTypes, "validConnectionTypes")) \
61 ((VstructMemberOf, "vstructMemberOf")) \
62 ((VstructMemberName, "vstructMemberName")) \
63 ((VstructConditionalExpr, "vstructConditionalExpr"))\
64 ((IsAssetIdentifier, "__SDR__isAssetIdentifier"))\
65 ((ImplementationName, "__SDR__implementationName"))\
66 ((SdrUsdDefinitionType, "sdrUsdDefinitionType"))\
67 ((DefaultInput, "__SDR__defaultinput")) \
68 ((Target, "__SDR__target")) \
69 ((Colorspace, "__SDR__colorspace"))
73#define SDR_PROPERTY_ROLE_TOKENS \
76#define SDR_PROPERTY_TOKENS \
77 ((PageDelimiter, ":"))
81 SDR_PROPERTY_METADATA_TOKENS);
83 SDR_PROPERTY_ROLE_TOKENS);
106 const SdrTokenMap& metadata,
107 const SdrTokenMap& hints,
108 const SdrOptionVec& options
139 bool IsArray()
const {
return (_arraySize > 0) || _isDynamicArray; }
211 const SdrTokenMap&
GetHints()
const {
return _hints; }
249 return _vstructMemberOf;
255 return _vstructMemberName;
270 return _vstructConditionalExpr;
291 return _validConnectionTypes;
328 return _sdfTypeDefaultValue;
353 friend void SdrShaderNode::_PostProcessProperties();
358 void _SetUsdEncodingVersion(
int usdEncodingVersion);
362 void _ConvertToVStruct();
366 void _ConvertExpressions(
const SdrShaderPropertyUniquePtrVec& properties,
367 SdrShaderNodeConstPtr shader);
372 void _FinalizeProperty();
380 bool _isDynamicArray;
382 SdrTokenMap _metadata;
386 const SdrTokenMap _hints;
387 const SdrOptionVec _options;
390 SdrTokenVec _validConnectionTypes;
396 TfToken _vstructConditionalExpr;
402 int _usdEncodingVersion;
405PXR_NAMESPACE_CLOSE_SCOPE
Represents a mapping from an Sdr Property type to Sdf type.
Represents a property (input or output) that is part of a SdrShaderNode instance.
SDR_API bool IsVStruct() const
Returns true if the field is the head of a vstruct.
SDR_API const TfToken & GetVStructMemberOf() const
If this field is part of a vstruct, this is the name of the struct.
SDR_API const SdrTokenMap & GetMetadata() const
All of the metadata that came from the parse process.
SDR_API const VtValue & GetDefaultValueAsSdfType() const
Accessor for default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.
SDR_API bool CanConnectTo(const SdrShaderProperty &other) const
Determines if this property can be connected to the specified property.
SDR_API bool IsOutput() const
Whether this property is an output.
SDR_API const TfToken & GetLabel() const
The label 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 ...
SDR_API const VtValue & GetDefaultValue() const
Gets this property's default value associated with the type of the property.
SDR_API bool IsAssetIdentifier() const
Determines if the value held by this property is an asset identifier (eg, a file path); the logic for...
SDR_API int GetArraySize() const
Gets this property's array size.
SDR_API const TfToken & GetType() const
Gets the type of the property.
SDR_API const TfToken & GetVStructMemberName() const
If this field is part of a vstruct, this is its name in the struct.
SDR_API const SdrTokenMap & GetHints() const
Any UI "hints" that are associated with this property.
SDR_API bool IsDynamicArray() const
Whether this property's array type is dynamically-sized.
SDR_API int GetTupleSize() const
Gets this property's tuple size.
SDR_API std::string GetHelp() const
The help message assigned to this property, if any.
SDR_API std::string GetShownIf() const
A boolean expression (SdfBooleanExpression) that determines if the property should be shown in the UI...
SDR_API SdrSdfTypeIndicator GetTypeAsSdfType() const
Converts the property's type from GetType() into a SdrSdfTypeIndicator.
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 ...
SDR_API std::string GetImplementationName() const
Returns the implementation name of this property.
virtual SDR_API ~SdrShaderProperty()
Destructor.
SDR_API bool IsArray() const
Whether this property's type is an array type.
SDR_API const TfToken & GetName() const
Gets the name of the property.
SDR_API bool IsDefaultInput() const
Determines if the value held by this property is the default input for this node.
SDR_API bool IsConnectable() const
Whether this property can be connected to other properties.
SDR_API std::string GetInfoString() const
Gets a string with basic information about this property.
SDR_API bool IsVStructMember() const
Returns true if this field is part of a vstruct.
SDR_API const TfToken & GetVStructConditionalExpr() const
If this field is part of a vstruct, this is the conditional expression.
SDR_API const SdrTokenVec & GetValidConnectionTypes() const
Gets the list of valid connection types for this property.
Token for efficient comparison, assignment, and hashing of known strings.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...