Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::EntityPrefabGraphDocument Class Reference

#include <EntityPrefabGraphDocument.h>

+ Collaboration diagram for Olympe::EntityPrefabGraphDocument:

Public Member Functions

 EntityPrefabGraphDocument ()
 
 ~EntityPrefabGraphDocument ()
 
NodeId CreateComponentNode (const std::string &componentType)
 
NodeId CreateComponentNode (const std::string &componentType, const std::string &componentName)
 
void RemoveNode (NodeId nodeId)
 
bool HasNode (NodeId nodeId) const
 
ComponentNodeGetNode (NodeId nodeId)
 
const ComponentNodeGetNode (NodeId nodeId) const
 
const std::vector< ComponentNode > & GetAllNodes () const
 
void SelectNode (NodeId nodeId)
 
void DeselectNode (NodeId nodeId)
 
void DeselectAll ()
 
NodeId GetSelectedNode () const
 
const std::vector< NodeId > & GetSelectedNodes () const
 
void AutoLayout ()
 
void ArrangeNodesInGrid (int gridWidth=4, float spacing=200.0f)
 
void CenterViewport ()
 
bool ConnectNodes (NodeId sourceId, NodeId targetId)
 
bool DisconnectNodes (NodeId sourceId, NodeId targetId)
 
const std::vector< std::pair< NodeId, NodeId > > & GetConnections () const
 
bool ValidateConnection (NodeId sourceId, NodeId targetId) const
 
bool HasConnection (NodeId sourceId, NodeId targetId) const
 
json ToJson () const
 
bool LoadFromFile (const std::string &filePath)
 
bool SaveToFile (const std::string &filePath)
 
void SetDocumentName (const std::string &name)
 
std::string GetDocumentName () const
 
Vector GetCanvasOffset () const
 
void SetCanvasOffset (const Vector &offset)
 
float GetCanvasZoom () const
 
void SetCanvasZoom (float zoom)
 
void Clear ()
 
size_t GetNodeCount () const
 
bool IsDirty () const
 
void SetDirty (bool dirty)
 
void LoadParameterSchemas (const std::string &schemasFilePath)
 
void InitializeNodeProperties (ComponentNode &node)
 

Static Public Member Functions

static EntityPrefabGraphDocument FromJson (const json &data)
 

Private Member Functions

NodeId GenerateNodeId ()
 
std::vector< LayoutNodeCalculateLayout ()
 

Private Attributes

std::vector< ComponentNodem_nodes
 
std::vector< NodeIdm_selectedNodes
 
std::vector< std::pair< NodeId, NodeId > > m_connections
 
std::string m_documentName
 
Vector m_canvasOffset
 
float m_canvasZoom = 1.0f
 
NodeId m_nextNodeId = 1
 
bool m_isDirty = false
 
std::map< std::string, std::map< std::string, std::string > > m_parameterSchemas
 

Detailed Description

Definition at line 22 of file EntityPrefabGraphDocument.h.

Constructor & Destructor Documentation

◆ EntityPrefabGraphDocument()

Olympe::EntityPrefabGraphDocument::EntityPrefabGraphDocument ( )

Definition at line 8 of file EntityPrefabGraphDocument.cpp.

Referenced by FromJson().

+ Here is the caller graph for this function:

◆ ~EntityPrefabGraphDocument()

Olympe::EntityPrefabGraphDocument::~EntityPrefabGraphDocument ( )

Definition at line 9 of file EntityPrefabGraphDocument.cpp.

Member Function Documentation

◆ ArrangeNodesInGrid()

void Olympe::EntityPrefabGraphDocument::ArrangeNodesInGrid ( int  gridWidth = 4,
float  spacing = 200.0f 
)

Definition at line 77 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_nodes.

Referenced by LoadFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AutoLayout()

void Olympe::EntityPrefabGraphDocument::AutoLayout ( )

Definition at line 75 of file EntityPrefabGraphDocument.cpp.

◆ CalculateLayout()

std::vector< LayoutNode > Olympe::EntityPrefabGraphDocument::CalculateLayout ( )
private

Definition at line 598 of file EntityPrefabGraphDocument.cpp.

◆ CenterViewport()

void Olympe::EntityPrefabGraphDocument::CenterViewport ( )

Definition at line 90 of file EntityPrefabGraphDocument.cpp.

◆ Clear()

void Olympe::EntityPrefabGraphDocument::Clear ( )

Definition at line 496 of file EntityPrefabGraphDocument.cpp.

References m_connections, m_isDirty, m_nextNodeId, m_nodes, and m_selectedNodes.

Referenced by LoadFromFile().

+ Here is the caller graph for this function:

◆ ConnectNodes()

bool Olympe::EntityPrefabGraphDocument::ConnectNodes ( NodeId  sourceId,
NodeId  targetId 
)

Definition at line 92 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), m_connections, m_isDirty, and ValidateConnection().

Referenced by Olympe::PrefabCanvas::CompleteConnection(), and LoadFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateComponentNode() [1/2]

NodeId Olympe::EntityPrefabGraphDocument::CreateComponentNode ( const std::string &  componentType)

Definition at line 11 of file EntityPrefabGraphDocument.cpp.

References CreateComponentNode().

Referenced by Olympe::PrefabCanvas::AcceptComponentDropAtScreenPos(), Olympe::PrefabCanvas::AddComponentNode(), CreateComponentNode(), and LoadFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateComponentNode() [2/2]

NodeId Olympe::EntityPrefabGraphDocument::CreateComponentNode ( const std::string &  componentType,
const std::string &  componentName 
)

Definition at line 14 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), InitializeNodeProperties(), m_isDirty, m_nextNodeId, and m_nodes.

+ Here is the call graph for this function:

◆ DeselectAll()

void Olympe::EntityPrefabGraphDocument::DeselectAll ( )

◆ DeselectNode()

void Olympe::EntityPrefabGraphDocument::DeselectNode ( NodeId  nodeId)

Definition at line 55 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), GetNode(), and m_selectedNodes.

Referenced by Olympe::PrefabCanvas::OnMouseDown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DisconnectNodes()

bool Olympe::EntityPrefabGraphDocument::DisconnectNodes ( NodeId  sourceId,
NodeId  targetId 
)

Definition at line 104 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), m_connections, and m_isDirty.

Referenced by Olympe::PrefabCanvas::RenderConnectionContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FromJson()

EntityPrefabGraphDocument Olympe::EntityPrefabGraphDocument::FromJson ( const json data)
static

Definition at line 149 of file EntityPrefabGraphDocument.cpp.

References EntityPrefabGraphDocument(), and GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ GenerateNodeId()

NodeId Olympe::EntityPrefabGraphDocument::GenerateNodeId ( )
private

◆ GetAllNodes()

const std::vector< ComponentNode > & Olympe::EntityPrefabGraphDocument::GetAllNodes ( ) const

◆ GetCanvasOffset()

Vector Olympe::EntityPrefabGraphDocument::GetCanvasOffset ( ) const

Definition at line 490 of file EntityPrefabGraphDocument.cpp.

References m_canvasOffset.

◆ GetCanvasZoom()

float Olympe::EntityPrefabGraphDocument::GetCanvasZoom ( ) const

Definition at line 493 of file EntityPrefabGraphDocument.cpp.

References m_canvasZoom.

◆ GetConnections()

const std::vector< std::pair< NodeId, NodeId > > & Olympe::EntityPrefabGraphDocument::GetConnections ( ) const

◆ GetDocumentName()

std::string Olympe::EntityPrefabGraphDocument::GetDocumentName ( ) const

Definition at line 488 of file EntityPrefabGraphDocument.cpp.

References m_documentName.

◆ GetNode() [1/2]

ComponentNode * Olympe::EntityPrefabGraphDocument::GetNode ( NodeId  nodeId)

◆ GetNode() [2/2]

const ComponentNode * Olympe::EntityPrefabGraphDocument::GetNode ( NodeId  nodeId) const

Definition at line 41 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_nodes.

+ Here is the call graph for this function:

◆ GetNodeCount()

size_t Olympe::EntityPrefabGraphDocument::GetNodeCount ( ) const

Definition at line 497 of file EntityPrefabGraphDocument.cpp.

References m_nodes.

Referenced by Olympe::PrefabCanvas::RenderContextMenu(), and Olympe::PrefabCanvas::RenderDebugInfo().

+ Here is the caller graph for this function:

◆ GetSelectedNode()

NodeId Olympe::EntityPrefabGraphDocument::GetSelectedNode ( ) const

Definition at line 70 of file EntityPrefabGraphDocument.cpp.

References Olympe::InvalidNodeId, and m_selectedNodes.

◆ GetSelectedNodes()

const std::vector< NodeId > & Olympe::EntityPrefabGraphDocument::GetSelectedNodes ( ) const

◆ HasConnection()

bool Olympe::EntityPrefabGraphDocument::HasConnection ( NodeId  sourceId,
NodeId  targetId 
) const

Definition at line 136 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_connections.

Referenced by ValidateConnection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasNode()

bool Olympe::EntityPrefabGraphDocument::HasNode ( NodeId  nodeId) const

Definition at line 35 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_nodes.

Referenced by ValidateConnection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitializeNodeProperties()

void Olympe::EntityPrefabGraphDocument::InitializeNodeProperties ( ComponentNode node)

Definition at line 585 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_parameterSchemas.

Referenced by CreateComponentNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDirty()

bool Olympe::EntityPrefabGraphDocument::IsDirty ( ) const

Definition at line 499 of file EntityPrefabGraphDocument.cpp.

References m_isDirty.

Referenced by Olympe::EntityPrefabRenderer::IsDirty().

+ Here is the caller graph for this function:

◆ LoadFromFile()

bool Olympe::EntityPrefabGraphDocument::LoadFromFile ( const std::string &  filePath)

◆ LoadParameterSchemas()

void Olympe::EntityPrefabGraphDocument::LoadParameterSchemas ( const std::string &  schemasFilePath)

Definition at line 502 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), m_parameterSchemas, and SYSTEM_LOG.

Referenced by LoadFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveNode()

void Olympe::EntityPrefabGraphDocument::RemoveNode ( NodeId  nodeId)

Definition at line 29 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), m_isDirty, and m_nodes.

Referenced by Olympe::PrefabCanvas::DeleteSelectedNodes(), and Olympe::PrefabCanvas::RenderContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SaveToFile()

bool Olympe::EntityPrefabGraphDocument::SaveToFile ( const std::string &  filePath)

◆ SelectNode()

void Olympe::EntityPrefabGraphDocument::SelectNode ( NodeId  nodeId)

◆ SetCanvasOffset()

void Olympe::EntityPrefabGraphDocument::SetCanvasOffset ( const Vector offset)

Definition at line 491 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_canvasOffset.

Referenced by LoadFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCanvasZoom()

void Olympe::EntityPrefabGraphDocument::SetCanvasZoom ( float  zoom)

Definition at line 494 of file EntityPrefabGraphDocument.cpp.

References m_canvasZoom.

Referenced by LoadFromFile().

+ Here is the caller graph for this function:

◆ SetDirty()

void Olympe::EntityPrefabGraphDocument::SetDirty ( bool  dirty)

Definition at line 500 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), and m_isDirty.

Referenced by Olympe::PropertyEditorPanel::ApplyChanges(), and Olympe::PrefabCanvas::RenderConnectionContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDocumentName()

void Olympe::EntityPrefabGraphDocument::SetDocumentName ( const std::string &  name)

Definition at line 487 of file EntityPrefabGraphDocument.cpp.

References m_documentName.

◆ ToJson()

json Olympe::EntityPrefabGraphDocument::ToJson ( ) const

Definition at line 148 of file EntityPrefabGraphDocument.cpp.

◆ ValidateConnection()

bool Olympe::EntityPrefabGraphDocument::ValidateConnection ( NodeId  sourceId,
NodeId  targetId 
) const

Definition at line 113 of file EntityPrefabGraphDocument.cpp.

References GetComponentTypeID_Static(), HasConnection(), and HasNode().

Referenced by ConnectNodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_canvasOffset

Vector Olympe::EntityPrefabGraphDocument::m_canvasOffset
private

Definition at line 94 of file EntityPrefabGraphDocument.h.

Referenced by GetCanvasOffset(), SaveToFile(), and SetCanvasOffset().

◆ m_canvasZoom

float Olympe::EntityPrefabGraphDocument::m_canvasZoom = 1.0f
private

Definition at line 95 of file EntityPrefabGraphDocument.h.

Referenced by GetCanvasZoom(), SaveToFile(), and SetCanvasZoom().

◆ m_connections

std::vector<std::pair<NodeId, NodeId> > Olympe::EntityPrefabGraphDocument::m_connections
private

◆ m_documentName

std::string Olympe::EntityPrefabGraphDocument::m_documentName
private

Definition at line 93 of file EntityPrefabGraphDocument.h.

Referenced by GetDocumentName(), and SetDocumentName().

◆ m_isDirty

bool Olympe::EntityPrefabGraphDocument::m_isDirty = false
private

◆ m_nextNodeId

NodeId Olympe::EntityPrefabGraphDocument::m_nextNodeId = 1
private

Definition at line 96 of file EntityPrefabGraphDocument.h.

Referenced by Clear(), and CreateComponentNode().

◆ m_nodes

std::vector<ComponentNode> Olympe::EntityPrefabGraphDocument::m_nodes
private

◆ m_parameterSchemas

std::map<std::string, std::map<std::string, std::string> > Olympe::EntityPrefabGraphDocument::m_parameterSchemas
private

◆ m_selectedNodes

std::vector<NodeId> Olympe::EntityPrefabGraphDocument::m_selectedNodes
private

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