|
Represents a property (input or output) that is part of a NdrNode
instance.
More...
#include <property.h>
Public Member Functions | |
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. | |
The Basics | |
NDR_API const TfToken & | GetName () const |
Gets the name of the property. | |
NDR_API const TfToken & | GetType () const |
Gets the type of the property. | |
NDR_API const VtValue & | GetDefaultValue () 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. | |
Metadata | |
The metadata returned here is a direct result of what the parser plugin is able to determine about the node. See the documentation for a specific parser plugin to get help on what the parser is looking for to populate these values. | |
virtual NDR_API const NdrTokenMap & | GetMetadata () const |
All of the metadata that came from the parse process. | |
Connection Information | |
virtual NDR_API bool | IsConnectable () const |
Whether this property can be connected to other properties. | |
virtual NDR_API bool | CanConnectTo (const NdrProperty &other) const |
Determines if this property can be connected to the specified property. | |
Utilities | |
virtual NDR_API NdrSdfTypeIndicator | GetTypeAsSdfType () const |
Converts the property's type from GetType() into a NdrSdfTypeIndicator . | |
virtual NDR_API const VtValue & | GetDefaultValueAsSdfType () const |
Provides default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType. | |
Protected Member Functions | |
NdrProperty & | operator= (const NdrProperty &)=delete |
Protected Attributes | |
TfToken | _name |
TfToken | _type |
VtValue | _defaultValue |
bool | _isOutput |
size_t | _arraySize |
bool | _isDynamicArray |
bool | _isConnectable |
NdrTokenMap | _metadata |
Represents a property (input or output) that is part of a NdrNode
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 NdrProperty
instance can be connected to it.
In almost all cases, this class will not be used directly. More specialized properties can be created that derive from NdrProperty
; those specialized properties can add their own domain-specific data and methods.
Definition at line 34 of file property.h.
NDR_API NdrProperty | ( | const TfToken & | name, |
const TfToken & | type, | ||
const VtValue & | defaultValue, | ||
bool | isOutput, | ||
size_t | arraySize, | ||
bool | isDynamicArray, | ||
const NdrTokenMap & | metadata | ||
) |
Constructor.
|
virtual |
Destructor.
|
virtual |
Determines if this property can be connected to the specified property.
Reimplemented in SdrShaderProperty.
|
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 92 of file property.h.
|
inline |
Gets this property's default value associated with the type of the property.
Definition at line 69 of file property.h.
|
virtual |
Provides default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.
Derived classes providing an implementation for GetTypeAsSdfType should also provide an implementation for this.
Reimplemented in SdrShaderProperty.
|
virtual |
Gets a string with basic information about this property.
Helpful for things like adding this property to a log.
|
inlinevirtual |
All of the metadata that came from the parse process.
Definition at line 111 of file property.h.
|
inline |
Gets the name of the property.
Definition at line 58 of file property.h.
|
inline |
Gets the type of the property.
Definition at line 62 of file property.h.
|
virtual |
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::HasSdfType will return false.
This base property class is generic and cannot know ahead of time how to perform this mapping reliably, thus it will always fall into the second scenario. It is up to specialized properties to perform the mapping.
Reimplemented in SdrShaderProperty.
|
inline |
Whether this property's type is an array type.
Definition at line 77 of file property.h.
|
virtual |
Whether this property can be connected to other properties.
Reimplemented in SdrShaderProperty.
|
inline |
Whether this property's array type is dynamically-sized.
Definition at line 81 of file property.h.
|
inline |
Whether this property is an output.
Definition at line 73 of file property.h.
|
protected |
Definition at line 170 of file property.h.
|
protected |
Definition at line 168 of file property.h.
|
protected |
Definition at line 172 of file property.h.
|
protected |
Definition at line 171 of file property.h.
|
protected |
Definition at line 169 of file property.h.
|
protected |
Definition at line 173 of file property.h.
|
protected |
Definition at line 166 of file property.h.
|
protected |
Definition at line 167 of file property.h.