Open 3D Engine GraphModel Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <Graph.h>
Inherits AZStd::enable_shared_from_this< Graph >.
Public Member Functions | |
AZ_CLASS_ALLOCATOR (Graph, AZ::SystemAllocator) | |
AZ_RTTI (Graph, "{CBF5DC3C-A0A7-45F5-A207-06433A9A10C5}") | |
Graph (const Graph &)=delete | |
Graph (GraphContextPtr graphContext) | |
void | PostLoadSetup (GraphContextPtr graphContext) |
NodeId | PostLoadSetup (NodePtr node) |
GraphContextPtr | GetContext () const |
Returns the interface to client system specific data and functionality. | |
const char * | GetSystemName () const |
NodeId | AddNode (NodePtr node) |
Adds a Node to the graph and gives it a unique ID. | |
bool | RemoveNode (ConstNodePtr node) |
Removes a Node and all connections between it and other Nodes in the graph. | |
void | WrapNode (NodePtr wrapperNode, NodePtr node, AZ::u32 layoutOrder=DefaultWrappedNodeLayoutOrder) |
void | UnwrapNode (ConstNodePtr node) |
Remove the wrapping from the specified node. | |
bool | IsNodeWrapped (NodePtr node) const |
Return if the specified node is a wrapped node. | |
const NodeWrappingMap & | GetNodeWrappings () |
Return our full map of node wrappings. | |
NodePtr | GetNode (NodeId nodeId) |
Search for a note with the corresponding ID. | |
const NodeMap & | GetNodes () |
Return a map of all nodes in the graph. | |
ConstNodeMap | GetNodes () const |
Return a map of all nodes in the graph. | |
size_t | GetNodeCount () const |
Return the number of nodes in the graph. | |
ConnectionPtr | AddConnection (SlotPtr sourceSlot, SlotPtr targetSlot) |
bool | RemoveConnection (ConstConnectionPtr connection) |
Removes a connection from the Graph, and returns whether it was found and removed. | |
const ConnectionList & | GetConnections () |
Return a container of all connections in the graph. | |
size_t | GetConnectionCount () const |
Return the number of connections for all nodes and slots in the graph. | |
void | SetUiMetadata (const GraphModelIntegration::GraphCanvasMetadata &uiMetadata) |
const GraphModelIntegration::GraphCanvasMetadata & | GetUiMetadata () const |
GraphModelIntegration::GraphCanvasMetadata & | GetUiMetadata () |
AZStd::shared_ptr< Slot > | FindSlot (const Endpoint &endpoint) |
void | ClearCachedData () |
Reset any data that was cached for this graph. | |
bool | Contains (SlotPtr slot) const |
ConnectionPtr | FindConnection (ConstSlotPtr sourceSlot, ConstSlotPtr targetSlot) |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
This is the main class for the GraphModel framework. It provides a generic node graph data model that is originally intended for use with Graph Canvas providing the UI, but in theory it could be used with any node graph widget system. It is also designed with primarily editor processing in mind, rather than runtime processing, so if this were to be used at runtime we may need some improvements.
Data Model Goals
Key elements of a Graph include
For continued reading, see Node.h next.
|
explicit |
Constructor
graphContext | interface to client system specific data and functionality |
ConnectionPtr GraphModel::Graph::AddConnection | ( | SlotPtr | sourceSlot, |
SlotPtr | targetSlot | ||
) |
Adds a new connection between sourceSlot and targetSlot and returns the new Connection, or returns the existing Connection if one already exists.
const char* GraphModel::Graph::GetSystemName | ( | ) | const |
This name is used for debug messages in GraphModel classes, to provide appropriate context for the user. It's a convenience function for GetContext()->GetSystemName()
void GraphModel::Graph::PostLoadSetup | ( | GraphContextPtr | graphContext | ) |
Initializion after the Graph has been serialized in. This must be called after building a Graph from serialized data in order to connect internal pointers between elements of the Graph and perform any other precedural setup that isn't stored in the serialized data.
graphContext | interface to client system specific data and functionality |
NodeId GraphModel::Graph::PostLoadSetup | ( | NodePtr | node | ) |
Add a node that has been deserialized to the graph This should only be necessary for cases like copy/paste where we need to load a deserialized node, but don't actually know the nodeId before-hand
void GraphModel::Graph::SetUiMetadata | ( | const GraphModelIntegration::GraphCanvasMetadata & | uiMetadata | ) |
Set/gets a bundle of generic metadata that is provided by the node graph UI system. This may include node positions, comment blocks, node groupings, and bookmarks, for example.
void GraphModel::Graph::WrapNode | ( | NodePtr | wrapperNode, |
NodePtr | node, | ||
AZ::u32 | layoutOrder = DefaultWrappedNodeLayoutOrder |
||
) |
Wrap (embed) the node onto the specified wrapperNode The wrapperNode and node must already exist in the graph before being wrapped