This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SdrShaderProperty Class Reference

A specialized version of NdrProperty which holds shading information. More...

#include <shaderProperty.h>

+ Inheritance diagram for SdrShaderProperty:

Public Member Functions

SDR_API SdrShaderProperty (const TfToken &name, const TfToken &type, const VtValue &defaultValue, bool isOutput, size_t arraySize, const NdrTokenMap &metadata, const NdrTokenMap &hints, const NdrOptionVec &options)
 
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 TfTokenGetLabel () 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 TfTokenGetPage () const
 The page (group), eg "Advanced", this property appears on, if any.
 
SDR_API const TfTokenGetWidget () 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 NdrTokenMap & GetHints () const
 Any UI "hints" that are associated with this property.
 
SDR_API const NdrOptionVec & 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.
 
VStruct Information
SDR_API const TfTokenGetVStructMemberOf () const
 If this field is part of a vstruct, this is the name of the struct.
 
SDR_API const TfTokenGetVStructMemberName () 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 TfTokenGetVStructConditionalExpr () const
 If this field is part of a vstruct, this is the conditional expression.
 
Connection Information
SDR_API bool IsConnectable () const override
 Whether this property can be connected to other properties.
 
SDR_API const NdrTokenVec & GetValidConnectionTypes () const
 Gets the list of valid connection types for this property.
 
SDR_API bool CanConnectTo (const NdrProperty &other) const override
 Determines if this property can be connected to the specified property.
 
Utilities
SDR_API NdrSdfTypeIndicator GetTypeAsSdfType () const override
 Converts the property's type from GetType() into a NdrSdfTypeIndicator.
 
SDR_API const VtValueGetDefaultValueAsSdfType () const override
 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.
 
- Public Member Functions inherited from NdrProperty
NDR_API NdrProperty (const TfToken &name, const TfToken &type, const VtValue &defaultValue, bool isOutput, size_t arraySize, bool isDynamicArray, const NdrTokenMap &metadata)
 Constructor.
 
virtual NDR_API ~NdrProperty ()
 Destructor.
 
NDR_API const TfTokenGetName () const
 Gets the name of the property.
 
NDR_API const TfTokenGetType () const
 Gets the type of the property.
 
NDR_API const VtValueGetDefaultValue () const
 Gets this property's default value associated with the type of the property.
 
NDR_API bool IsOutput () const
 Whether this property is an output.
 
NDR_API bool IsArray () const
 Whether this property's type is an array type.
 
NDR_API bool IsDynamicArray () const
 Whether this property's array type is dynamically-sized.
 
NDR_API int GetArraySize () const
 Gets this property's array size.
 
virtual NDR_API std::string GetInfoString () const
 Gets a string with basic information about this property.
 
virtual NDR_API const NdrTokenMap & GetMetadata () const
 All of the metadata that came from the parse process.
 

Protected Member Functions

SdrShaderPropertyoperator= (const SdrShaderProperty &)=delete
 
void _SetUsdEncodingVersion (int usdEncodingVersion)
 
void _ConvertToVStruct ()
 
void _FinalizeProperty ()
 
- Protected Member Functions inherited from NdrProperty
NdrPropertyoperator= (const NdrProperty &)=delete
 

Protected Attributes

const NdrTokenMap _hints
 
const NdrOptionVec _options
 
NdrTokenVec _validConnectionTypes
 
TfToken _label
 
TfToken _page
 
TfToken _widget
 
TfToken _vstructMemberOf
 
TfToken _vstructMemberName
 
TfToken _vstructConditionalExpr
 
VtValue _sdfTypeDefaultValue
 
int _usdEncodingVersion
 
- Protected Attributes inherited from NdrProperty
TfToken _name
 
TfToken _type
 
VtValue _defaultValue
 
bool _isOutput
 
size_t _arraySize
 
bool _isDynamicArray
 
bool _isConnectable
 
NdrTokenMap _metadata
 

Friends

void SdrShaderNode::_PostProcessProperties ()
 

Detailed Description

A specialized version of NdrProperty which holds shading information.

Definition at line 87 of file shaderProperty.h.

Member Function Documentation

◆ CanConnectTo()

SDR_API bool CanConnectTo ( const NdrProperty other) const
overridevirtual

Determines if this property can be connected to the specified property.

Reimplemented from NdrProperty.

◆ GetDefaultValueAsSdfType()

SDR_API const VtValue & GetDefaultValueAsSdfType ( ) const
inlineoverridevirtual

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.

See also
GetTypeAsSdfType

Reimplemented from NdrProperty.

Definition at line 238 of file shaderProperty.h.

◆ GetHelp()

SDR_API std::string GetHelp ( ) const

The help message assigned to this property, if any.

◆ GetHints()

SDR_API const NdrTokenMap & GetHints ( ) const
inline

Any UI "hints" that are associated with this property.

"Hints" are simple key/value pairs.

Definition at line 135 of file shaderProperty.h.

◆ GetImplementationName()

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.

◆ GetLabel()

SDR_API const TfToken & GetLabel ( ) const
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 114 of file shaderProperty.h.

◆ GetOptions()

SDR_API const NdrOptionVec & GetOptions ( ) const
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 141 of file shaderProperty.h.

◆ GetPage()

SDR_API const TfToken & GetPage ( ) const
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 124 of file shaderProperty.h.

◆ GetTypeAsSdfType()

SDR_API NdrSdfTypeIndicator GetTypeAsSdfType ( ) const
overridevirtual

Converts the property's type from GetType() into a NdrSdfTypeIndicator.

Two scenarios can result: an exact mapping from property type to Sdf type, and an inexact mapping. In the first scenario, NdrSdfTypeIndicator will contain a cleanly-mapped Sdf type. In the second scenario, the NdrSdfTypeIndicator will contain an Sdf type set to Token to indicate an unclean mapping, and NdrSdfTypeIndicator::GetNdrType will be set to the original type returned by GetType().

Reimplemented from NdrProperty.

◆ GetValidConnectionTypes()

SDR_API const NdrTokenVec & GetValidConnectionTypes ( ) const
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 NdrProperty::GetType() can be used as a fallback, or you can use the connectability test in CanConnectTo().

Definition at line 203 of file shaderProperty.h.

◆ GetVStructConditionalExpr()

SDR_API const TfToken & GetVStructConditionalExpr ( ) const
inline

If this field is part of a vstruct, this is the conditional expression.

Definition at line 182 of file shaderProperty.h.

◆ GetVStructMemberName()

SDR_API const TfToken & GetVStructMemberName ( ) const
inline

If this field is part of a vstruct, this is its name in the struct.

Definition at line 167 of file shaderProperty.h.

◆ GetVStructMemberOf()

SDR_API const TfToken & GetVStructMemberOf ( ) const
inline

If this field is part of a vstruct, this is the name of the struct.

Definition at line 161 of file shaderProperty.h.

◆ GetWidget()

SDR_API const TfToken & GetWidget ( ) const
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 130 of file shaderProperty.h.

◆ IsAssetIdentifier()

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).

◆ IsConnectable()

SDR_API bool IsConnectable ( ) const
inlineoverridevirtual

Whether this property can be connected to other properties.

If this returns true, connectability to a specific property can be tested via CanConnectTo().

Reimplemented from NdrProperty.

Definition at line 196 of file shaderProperty.h.

◆ IsDefaultInput()

SDR_API bool IsDefaultInput ( ) const

Determines if the value held by this property is the default input for this node.

◆ IsVStruct()

SDR_API bool IsVStruct ( ) const

Returns true if the field is the head of a vstruct.

◆ IsVStructMember()

SDR_API bool IsVStructMember ( ) const

Returns true if this field is part of a vstruct.

Member Data Documentation

◆ _hints

const NdrTokenMap _hints
protected

Definition at line 282 of file shaderProperty.h.

◆ _label

TfToken _label
protected

Definition at line 287 of file shaderProperty.h.

◆ _options

const NdrOptionVec _options
protected

Definition at line 283 of file shaderProperty.h.

◆ _page

TfToken _page
protected

Definition at line 288 of file shaderProperty.h.

◆ _sdfTypeDefaultValue

VtValue _sdfTypeDefaultValue
protected

Definition at line 294 of file shaderProperty.h.

◆ _usdEncodingVersion

int _usdEncodingVersion
protected

Definition at line 298 of file shaderProperty.h.

◆ _validConnectionTypes

NdrTokenVec _validConnectionTypes
protected

Definition at line 286 of file shaderProperty.h.

◆ _vstructConditionalExpr

TfToken _vstructConditionalExpr
protected

Definition at line 292 of file shaderProperty.h.

◆ _vstructMemberName

TfToken _vstructMemberName
protected

Definition at line 291 of file shaderProperty.h.

◆ _vstructMemberOf

TfToken _vstructMemberOf
protected

Definition at line 290 of file shaderProperty.h.

◆ _widget

TfToken _widget
protected

Definition at line 289 of file shaderProperty.h.


The documentation for this class was generated from the following file: