Loading...
Searching...
No Matches
UsdShadeConnectableAPIBehavior Class Reference

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

#include <connectableAPIBehavior.h>

Public Types

enum  ConnectableNodeTypes { BasicNodes , DerivedContainerNodes }
 An enum describing the types of connectable nodes which will govern what connectibility rule is invoked for these. More...
 

Public Member Functions

USDSHADE_API UsdShadeConnectableAPIBehavior (const bool isContainer, const bool requiresEncapsulation)
 
virtual USDSHADE_API bool CanConnectInputToSource (const UsdShadeInput &, const UsdAttribute &, std::string *reason) const
 The prim owning the input is guaranteed to be of the type this behavior was registered with.
 
virtual USDSHADE_API bool CanConnectOutputToSource (const UsdShadeOutput &, const UsdAttribute &, std::string *reason) const
 The prim owning the output is guaranteed to be of the type this behavior was registered with.
 
virtual USDSHADE_API bool IsContainer () const final
 The function must be thread-safe.
 
virtual USDSHADE_API bool RequiresEncapsulation () const final
 The function must be thread-safe.
 

Protected Member Functions

USDSHADE_API bool _CanConnectInputToSource (const UsdShadeInput &, const UsdAttribute &, std::string *reason, ConnectableNodeTypes nodeType=ConnectableNodeTypes::BasicNodes) const
 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.
 
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

◆ ConnectableNodeTypes

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

Definition at line 54 of file connectableAPIBehavior.h.

Constructor & Destructor Documentation

◆ UsdShadeConnectableAPIBehavior() [1/2]

USDSHADE_API UsdShadeConnectableAPIBehavior ( )
inline

Definition at line 63 of file connectableAPIBehavior.h.

◆ UsdShadeConnectableAPIBehavior() [2/2]

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

Definition at line 67 of file connectableAPIBehavior.h.

Member Function Documentation

◆ _CanConnectInputToSource()

USDSHADE_API bool _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.

◆ CanConnectInputToSource()

virtual USDSHADE_API bool 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().

◆ CanConnectOutputToSource()

virtual USDSHADE_API bool 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.

◆ IsContainer()

virtual USDSHADE_API bool 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.

◆ RequiresEncapsulation()

virtual USDSHADE_API bool RequiresEncapsulation ( ) const
finalvirtual

The function must be thread-safe.

Determines if the behavior should respect container encapsulation rules (Connectability Rules for UsdShade Types), 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: