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
NdrProperty Class Reference

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

#include <property.h>

+ 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.
 
virtual NDR_API ~NdrProperty ()
 Destructor.
 
The Basics
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.
 
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 VtValueGetDefaultValueAsSdfType () const
 Provides default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.
 

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

Constructor & Destructor Documentation

◆ NdrProperty()

NDR_API NdrProperty ( const TfToken name,
const TfToken type,
const VtValue defaultValue,
bool  isOutput,
size_t  arraySize,
bool  isDynamicArray,
const NdrTokenMap &  metadata 
)

Constructor.

◆ ~NdrProperty()

virtual NDR_API ~NdrProperty ( )
virtual

Destructor.

Member Function Documentation

◆ CanConnectTo()

virtual NDR_API bool CanConnectTo ( const NdrProperty other) const
virtual

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

Reimplemented in SdrShaderProperty.

◆ GetArraySize()

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

◆ GetDefaultValue()

NDR_API const VtValue & GetDefaultValue ( ) const
inline

Gets this property's default value associated with the type of the property.

See also
GetType()

Definition at line 69 of file property.h.

◆ GetDefaultValueAsSdfType()

virtual NDR_API const VtValue & GetDefaultValueAsSdfType ( ) const
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.

See also
GetTypeAsSdfType()

Reimplemented in SdrShaderProperty.

◆ GetInfoString()

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.

◆ GetMetadata()

virtual NDR_API const NdrTokenMap & GetMetadata ( ) const
inlinevirtual

All of the metadata that came from the parse process.

Definition at line 111 of file property.h.

◆ GetName()

NDR_API const TfToken & GetName ( ) const
inline

Gets the name of the property.

Definition at line 58 of file property.h.

◆ GetType()

NDR_API const TfToken & GetType ( ) const
inline

Gets the type of the property.

Definition at line 62 of file property.h.

◆ GetTypeAsSdfType()

virtual NDR_API NdrSdfTypeIndicator GetTypeAsSdfType ( ) const
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.

See also
GetDefaultValueAsSdfType()

Reimplemented in SdrShaderProperty.

◆ IsArray()

NDR_API bool IsArray ( ) const
inline

Whether this property's type is an array type.

Definition at line 77 of file property.h.

◆ IsConnectable()

virtual NDR_API bool IsConnectable ( ) const
virtual

Whether this property can be connected to other properties.

Reimplemented in SdrShaderProperty.

◆ IsDynamicArray()

NDR_API bool IsDynamicArray ( ) const
inline

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

Definition at line 81 of file property.h.

◆ IsOutput()

NDR_API bool IsOutput ( ) const
inline

Whether this property is an output.

Definition at line 73 of file property.h.

Member Data Documentation

◆ _arraySize

size_t _arraySize
protected

Definition at line 170 of file property.h.

◆ _defaultValue

VtValue _defaultValue
protected

Definition at line 168 of file property.h.

◆ _isConnectable

bool _isConnectable
protected

Definition at line 172 of file property.h.

◆ _isDynamicArray

bool _isDynamicArray
protected

Definition at line 171 of file property.h.

◆ _isOutput

bool _isOutput
protected

Definition at line 169 of file property.h.

◆ _metadata

NdrTokenMap _metadata
protected

Definition at line 173 of file property.h.

◆ _name

TfToken _name
protected

Definition at line 166 of file property.h.

◆ _type

TfToken _type
protected

Definition at line 167 of file property.h.


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