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"
23#include "pxr/usd/sdr/shaderPropertyMetadata.h"
25PXR_NAMESPACE_OPEN_SCOPE
29#define SDR_PROPERTY_TYPE_TOKENS \
31 ((String, "string")) \
34 ((Color4, "color4")) \
36 ((Normal, "normal")) \
37 ((Vector, "vector")) \
38 ((Matrix, "matrix")) \
39 ((Struct, "struct")) \
40 ((Terminal, "terminal")) \
41 ((Vstruct, "vstruct")) \
42 ((Unknown, "unknown"))
76 const SdrTokenMap& hints,
77 const SdrOptionVec& options
108 bool IsArray()
const {
return (_arraySize > 0) || _isDynamicArray; }
160 const SdrTokenMap&
GetMetadata()
const {
return _legacyMetadata; }
192 const SdrTokenMap&
GetHints()
const {
return _hints; }
230 return _vstructMemberOf;
236 return _vstructMemberName;
251 return _vstructConditionalExpr;
276 return _validConnectionTypes;
313 return _sdfTypeDefaultValue;
338 friend void SdrShaderNode::_PostProcessProperties();
343 void _SetUsdEncodingVersion(
int usdEncodingVersion);
347 void _ConvertToVStruct();
351 void _ConvertExpressions(
const SdrShaderPropertyUniquePtrVec& properties,
352 SdrShaderNodeConstPtr shader);
357 void _FinalizeProperty();
365 bool _isDynamicArray;
367 SdrTokenMap _legacyMetadata;
372 const SdrTokenMap _hints;
373 const SdrOptionVec _options;
376 SdrTokenVec _validConnectionTypes;
382 TfToken _vstructConditionalExpr;
388 int _usdEncodingVersion;
391PXR_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 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 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.
const SdrShaderPropertyMetadata & GetMetadataObject() const
All of the metadata that came from the parse process.
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.
const SdrTokenMap & GetMetadata() const
All of the metadata that came from the parse process.
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...