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

#include <connectableAPIBehavior.h>

Public Types

enum  ConnectableNodeTypes { BasicNodes, DerivedContainerNodes }
 

Public Member Functions

USDSHADE_API UsdShadeConnectableAPIBehavior ()
 
USDSHADE_API UsdShadeConnectableAPIBehavior (const bool isContainer, const bool requiresEncapsulation)
 
virtual USDSHADE_API ~UsdShadeConnectableAPIBehavior ()
 
virtual USDSHADE_API bool CanConnectInputToSource (const UsdShadeInput &, const UsdAttribute &, std::string *reason) const
 
virtual USDSHADE_API bool CanConnectOutputToSource (const UsdShadeOutput &, const UsdAttribute &, std::string *reason) const
 
virtual USDSHADE_API bool IsContainer () const final
 
virtual USDSHADE_API bool RequiresEncapsulation () const final
 

Protected Member Functions

USDSHADE_API bool _CanConnectInputToSource (const UsdShadeInput &, const UsdAttribute &, std::string *reason, ConnectableNodeTypes nodeType=ConnectableNodeTypes::BasicNodes) const
 
USDSHADE_API bool _CanConnectOutputToSource (const UsdShadeOutput &, const UsdAttribute &, std::string *reason, ConnectableNodeTypes nodeType=ConnectableNodeTypes::BasicNodes) const
 

Detailed Description

UsdShadeConnectableAPIBehavior defines the compatibilty and behavior UsdShadeConnectableAPIof when applied to a particular prim type.

This enables schema libraries to enable UsdShadeConnectableAPI for their prim types and define its behavior.

Definition at line 48 of file connectableAPIBehavior.h.

Member Enumeration Documentation

An enum describing the types of connectable nodes which will govern what connectibility rule is invoked for these.

Enumerator
BasicNodes 
DerivedContainerNodes 

Definition at line 54 of file connectableAPIBehavior.h.

Constructor & Destructor Documentation

USDSHADE_API UsdShadeConnectableAPIBehavior::UsdShadeConnectableAPIBehavior ( )
inline

Definition at line 63 of file connectableAPIBehavior.h.

USDSHADE_API UsdShadeConnectableAPIBehavior::UsdShadeConnectableAPIBehavior ( const bool  isContainer,
const bool  requiresEncapsulation 
)
inline

Definition at line 67 of file connectableAPIBehavior.h.

virtual USDSHADE_API UsdShadeConnectableAPIBehavior::~UsdShadeConnectableAPIBehavior ( )
virtual

Member Function Documentation

USDSHADE_API bool UsdShadeConnectableAPIBehavior::_CanConnectInputToSource ( const UsdShadeInput ,
const UsdAttribute ,
std::string reason,
ConnectableNodeTypes  nodeType = ConnectableNodeTypes::BasicNodes 
) const
protected

Helper function to separate and share special connectivity logic for specialized, NodeGraph-derived nodes, like Material (and other in other domains) that allow their inputs to be connected to an output of a source that they directly contain/encapsulate. The default behavior is for Shader Nodes or NodeGraphs which allow their input connections to output of a sibling source, both encapsulated by the same container node.

USDSHADE_API bool UsdShadeConnectableAPIBehavior::_CanConnectOutputToSource ( const UsdShadeOutput ,
const UsdAttribute ,
std::string reason,
ConnectableNodeTypes  nodeType = ConnectableNodeTypes::BasicNodes 
) const
protected
virtual USDSHADE_API bool UsdShadeConnectableAPIBehavior::CanConnectInputToSource ( const UsdShadeInput ,
const UsdAttribute ,
std::string reason 
) const
virtual

The prim owning the input is guaranteed to be of the type this behavior was registered with. The function must be thread-safe.

It should return true if the connection is allowed, false otherwise. If the connection is prohibited and reason is non-NULL, it should be set to a user-facing description of the reason the connection is prohibited.

The base implementation checks that the input is defined; that the source attribute exists; and that the connectability metadata on the input allows a connection from the attribute – see UsdShadeInput::GetConnectability().

virtual USDSHADE_API bool UsdShadeConnectableAPIBehavior::CanConnectOutputToSource ( const UsdShadeOutput ,
const UsdAttribute ,
std::string reason 
) const
virtual

The prim owning the output is guaranteed to be of the type this behavior was registered with. The function must be thread-safe.

It should return true if the connection is allowed, false otherwise. If the connection is prohibited and reason is non-NULL, it should be set to a user-facing description of the reason the connection is prohibited.

The base implementation returns false. Outputs of most prim types will be defined by the underlying node definition (see UsdShadeNodeDefAPI), not a connection.

virtual USDSHADE_API bool UsdShadeConnectableAPIBehavior::IsContainer ( ) const
finalvirtual

The function must be thread-safe.

It should return true if the associated prim type is considered a "container" for connected nodes. Returns the value set for _isContainer.

virtual USDSHADE_API bool UsdShadeConnectableAPIBehavior::RequiresEncapsulation ( ) const
finalvirtual

The function must be thread-safe.

Determines if the behavior should respect container encapsulation rules (UsdShadeConnectability), when evaluating CanConnectInputToSource or CanConnectOutputToSource. This should return true if the container encapsulation rules need to be respected, false otherwise. Returns the value set for _requiresEncapsulation.

See Also
IsContainer()

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