Open 3D Engine GraphModel Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
GraphModel::Slot Class Reference

!! Start in Graph.h for high level GraphModel documentation !!! More...

#include <Slot.h>

Inherits GraphModel::GraphElement, and AZStd::enable_shared_from_this< Slot >.

Public Types

using ConnectionList = AZStd::vector< AZStd::shared_ptr< Connection > >
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (Slot, AZ::SystemAllocator)
 
 AZ_RTTI (Slot, "{50494867-04F1-4785-BB9C-9D6C96DCBFC9}", GraphElement)
 
 Slot (GraphPtr graph, SlotDefinitionPtr slotDefinition, SlotSubId subId=0)
 
virtual void PostLoadSetup (GraphPtr graph, SlotDefinitionPtr slotDefinition)
 
SlotDefinitionPtr GetDefinition () const
 Return the SlotDefinition that defines this Slot.
 
bool Is (SlotDirection slotDirection, SlotType slotType) const
 Convenience functions that wrap SlotDefinition accessors.
 
SlotDirection GetSlotDirection () const
 
SlotType GetSlotType () const
 
bool SupportsValues () const
 
bool SupportsDataTypes () const
 
bool SupportsConnections () const
 
bool SupportsExtendability () const
 
bool IsVisibleOnNode () const
 
bool IsEditableOnNode () const
 
const SlotName & GetName () const
 
const AZStd::string & GetDisplayName () const
 
const AZStd::string & GetDescription () const
 
const AZStd::vector< AZStd::string > & GetEnumValues () const
 
DataTypePtr GetDataType () const
 Valid for Data and Property slots. Otherwise returns null.
 
DataTypePtr GetDefaultDataType () const
 Valid for Data and Property slots. Otherwise returns null.
 
AZStd::any GetDefaultValue () const
 Valid for Data and Property slots. Otherwise returns an empty AZStd::any.
 
const DataTypeList & GetSupportedDataTypes () const
 
bool IsSupportedDataType (DataTypePtr dataType) const
 Return true if the input data type is supported by this slot.
 
const int GetMinimumSlots () const
 Convenience functions that wrap SlotDefinition accessors (specific to definitions that support extendable slots)
 
const int GetMaximumSlots () const
 
SlotId GetSlotId () const
 
SlotSubId GetSlotSubId () const
 
NodePtr GetParentNode () const
 
AZStd::any GetValue () const
 
template<typename T >
GetValue () const
 
template<typename T >
void SetValue (const T &value)
 
void SetValue (const AZStd::any &value)
 
const ConnectionList & GetConnections () const
 
void ClearCachedData ()
 Reset any data that was cached for this slot.
 
- Public Member Functions inherited from GraphModel::GraphElement
 AZ_CLASS_ALLOCATOR (GraphElement, AZ::SystemAllocator)
 
 AZ_RTTI (GraphElement, "{FD83C7CA-556B-49F1-BACE-6E9C7A4D6347}")
 
 GraphElement (GraphPtr graph)
 
GraphPtr GetGraph () const
 Returns the Graph that owns this GraphElement.
 
GraphContextPtr GetGraphContext () const
 Returns the GraphContext for this GraphElement.
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
- Static Public Member Functions inherited from GraphModel::GraphElement
static void Reflect (AZ::ReflectContext *context)
 

Additional Inherited Members

- Protected Attributes inherited from GraphModel::GraphElement
AZStd::weak_ptr< Graphm_graph
 

Detailed Description

!! Start in Graph.h for high level GraphModel documentation !!!

Represents the instance of a slot, based on a specific SlotDefinition. If you think of the SlotDefinition as a class declaration, then a Slot is like an instance of that class. Slots may contain data like default values and connections to other Slots. The specific set of supported features is determined by the SlotDefinition's combination of SlotType and SlotDirection.

(We take the approach of using a single class with some features unused in specific configurations because it ends up being cleaner than a complex class hierarchy).

Constructor & Destructor Documentation

◆ Slot()

GraphModel::Slot::Slot ( GraphPtr  graph,
SlotDefinitionPtr  slotDefinition,
SlotSubId  subId = 0 
)

Constructor

Parameters
graphThe Graph that will own this Slot
slotDefinitionThe descriptor that defines this Slot
subIdThe subId that is used to identify extendable slots

Member Function Documentation

◆ GetConnections()

const ConnectionList & GraphModel::Slot::GetConnections ( ) const

Returns the list of connections to this Slot. (Property slots will never have connections)

◆ GetParentNode()

NodePtr GraphModel::Slot::GetParentNode ( ) const

Get the Node that contains this Slot. This function cannot be called until this Slot is added to a Node and that Node is added to the Graph.

◆ GetSupportedDataTypes()

const DataTypeList & GraphModel::Slot::GetSupportedDataTypes ( ) const

Valid for Data and Property slots. Otherwise returns an empty DataTypeList. If valid, this will return the full list of all data types this slot could support.

◆ GetValue() [1/2]

AZStd::any GraphModel::Slot::GetValue ( ) const

Return the slot's value, which will be used if there are no input connections. Valid for Input Data and Property slots.

◆ GetValue() [2/2]

template<typename T >
T GraphModel::Slot::GetValue

Return the slot's value, which will be used if there are no input connections. Returns 0 if the type doesn't match. Type template type T must match the slot's data type. Valid for Input Data and Property slots.

◆ PostLoadSetup()

virtual void GraphModel::Slot::PostLoadSetup ( GraphPtr  graph,
SlotDefinitionPtr  slotDefinition 
)
virtual

Initializion after the Slot has been serialized in. This must be called whenever the default constructor is used. Sets the m_graph pointer and caches pointers to other GraphElements.

◆ SetValue() [1/2]

void GraphModel::Slot::SetValue ( const AZStd::any &  value)

Sets the slot's value, which will be used if there are no input connections. AZStd::any type must match the slot's data type. Valid for Input Data and Property slots.

◆ SetValue() [2/2]

template<typename T >
void GraphModel::Slot::SetValue ( const T &  value)

Sets the slot's value, which will be used if there are no input connections. Type template type T must match the slot's data type. Valid for Input Data and Property slots.


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