All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdrProperty Class Reference

Represents a property (input or output) that is part of a NdrNode instance. More...

+ Inheritance diagram for NdrProperty:

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. More...
 
virtual NDR_API ~NdrProperty ()
 Destructor. More...
 
The Basics
NDR_API const TfTokenGetName () const
 Gets the name of the property. More...
 
NDR_API const TfTokenGetType () const
 Gets the type of the property. More...
 
NDR_API const VtValueGetDefaultValue () const
 Gets this property's default value. More...
 
NDR_API bool IsOutput () const
 Whether this property is an output. More...
 
NDR_API bool IsArray () const
 Whether this property's type is an array type. More...
 
NDR_API bool IsDynamicArray () const
 Whether this property's array type is dynamically-sized. More...
 
NDR_API int GetArraySize () const
 Gets this property's array size. More...
 
virtual NDR_API std::string GetInfoString () const
 Gets a string with basic information about this property. More...
 
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. More...
 
Connection Information
virtual NDR_API bool IsConnectable () const
 Whether this property can be connected to other properties. More...
 
virtual NDR_API bool CanConnectTo (const NdrProperty &other) const
 Determines if this property can be connected to the specified property. More...
 
Utilities
virtual NDR_API const
NdrSdfTypeIndicator 
GetTypeAsSdfType () const
 Converts the property's type from GetType() into a SdfValueTypeName. More...
 

Protected Member Functions

NdrPropertyoperator= (const NdrProperty &)=delete
 

Protected Attributes

TfToken _name
 
TfToken _type
 
VtValue _defaultValue
 
bool _isOutput
 
size_t _arraySize
 
bool _isDynamicArray
 
bool _isConnectable
 
NdrTokenMap _metadata
 

Detailed Description

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 50 of file property.h.

Constructor & Destructor Documentation

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 ( )
virtual

Destructor.

Member Function Documentation

virtual NDR_API bool CanConnectTo ( const NdrProperty other) const
virtual

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

Reimplemented in SdrShaderProperty.

NDR_API int GetArraySize ( ) const
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 105 of file property.h.

NDR_API const VtValue& GetDefaultValue ( ) const
inline

Gets this property's default value.

Definition at line 82 of file property.h.

virtual NDR_API std::string GetInfoString ( ) const
virtual

Gets a string with basic information about this property.

Helpful for things like adding this property to a log.

virtual NDR_API const NdrTokenMap& GetMetadata ( ) const
inlinevirtual

All of the metadata that came from the parse process.

Definition at line 124 of file property.h.

NDR_API const TfToken& GetName ( ) const
inline

Gets the name of the property.

Definition at line 74 of file property.h.

NDR_API const TfToken& GetType ( ) const
inline

Gets the type of the property.

Definition at line 78 of file property.h.

virtual NDR_API const NdrSdfTypeIndicator GetTypeAsSdfType ( ) const
virtual

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

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

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.

NDR_API bool IsArray ( ) const
inline

Whether this property's type is an array type.

Definition at line 90 of file property.h.

virtual NDR_API bool IsConnectable ( ) const
virtual

Whether this property can be connected to other properties.

Reimplemented in SdrShaderProperty.

NDR_API bool IsDynamicArray ( ) const
inline

Whether this property's array type is dynamically-sized.

Definition at line 94 of file property.h.

NDR_API bool IsOutput ( ) const
inline

Whether this property is an output.

Definition at line 86 of file property.h.


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