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

Command to delete a node from the tree. More...

#include <BTEditorCommand.h>

+ Inheritance diagram for Olympe::DeleteNodeCommand:
+ Collaboration diagram for Olympe::DeleteNodeCommand:

Classes

struct  Connection
 

Public Member Functions

 DeleteNodeCommand (BehaviorTreeAsset *tree, uint32_t nodeId)
 
void Execute () override
 Execute the command.
 
void Undo () override
 Undo the command.
 
std::string GetDescription () const override
 Get a human-readable description of the command.
 
 DeleteNodeCommand (int32_t nodeID)
 
void Execute (TaskGraphTemplate &graph) override
 Applies the command to the graph.
 
void Undo (TaskGraphTemplate &graph) override
 Reverses the command on the graph.
 
std::string GetDescription () const override
 Get a human-readable description of the command.
 
- Public Member Functions inherited from Olympe::BTEditorCommand
virtual ~BTEditorCommand ()=default
 
virtual ~BTEditorCommand ()=default
 
- Public Member Functions inherited from Olympe::ICommand
virtual ~ICommand ()=default
 

Private Attributes

BehaviorTreeAssetm_tree
 
uint32_t m_nodeId
 
BTNode m_savedNode
 
std::vector< Connectionm_savedConnections
 
int32_t m_nodeID
 
TaskNodeDefinition m_savedNode
 
std::vector< ExecPinConnectionm_savedExecConns
 
std::vector< DataPinConnectionm_savedDataConns
 

Detailed Description

Command to delete a node from the tree.

Records a "delete node" operation for undo/redo.

On Execute() the node is removed from the graph (and any exec/data connections referencing it are also removed). On Undo() the node and its connections are restored.

Definition at line 131 of file BTEditorCommand.h.

Constructor & Destructor Documentation

◆ DeleteNodeCommand() [1/2]

Olympe::DeleteNodeCommand::DeleteNodeCommand ( BehaviorTreeAsset tree,
uint32_t  nodeId 
)

Definition at line 139 of file BTEditorCommand.cpp.

References GetComponentTypeID_Static(), m_savedConnections, m_savedNode, and Olympe::DeleteNodeCommand::Connection::parentId.

+ Here is the call graph for this function:

◆ DeleteNodeCommand() [2/2]

Olympe::DeleteNodeCommand::DeleteNodeCommand ( int32_t  nodeID)
explicit

Definition at line 51 of file UndoRedoStack.cpp.

Member Function Documentation

◆ Execute() [1/2]

void Olympe::DeleteNodeCommand::Execute ( )
overridevirtual

Execute the command.

Implements Olympe::BTEditorCommand.

Definition at line 182 of file BTEditorCommand.cpp.

References m_nodeId, m_tree, and BehaviorTreeAsset::RemoveNode().

+ Here is the call graph for this function:

◆ Execute() [2/2]

void Olympe::DeleteNodeCommand::Execute ( TaskGraphTemplate graph)
overridevirtual

Applies the command to the graph.

Implements Olympe::ICommand.

Definition at line 56 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), m_nodeID, m_savedDataConns, m_savedExecConns, and m_savedNode.

+ Here is the call graph for this function:

◆ GetDescription() [1/2]

std::string Olympe::DeleteNodeCommand::GetDescription ( ) const
overridevirtual

Get a human-readable description of the command.

Implements Olympe::BTEditorCommand.

Definition at line 227 of file BTEditorCommand.cpp.

References m_nodeId.

◆ GetDescription() [2/2]

std::string Olympe::DeleteNodeCommand::GetDescription ( ) const
overridevirtual

Get a human-readable description of the command.

Implements Olympe::BTEditorCommand.

◆ Undo() [1/2]

void Olympe::DeleteNodeCommand::Undo ( )
overridevirtual

◆ Undo() [2/2]

void Olympe::DeleteNodeCommand::Undo ( TaskGraphTemplate graph)
overridevirtual

Reverses the command on the graph.

Implements Olympe::ICommand.

Definition at line 104 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), m_savedDataConns, m_savedExecConns, and m_savedNode.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nodeId

uint32_t Olympe::DeleteNodeCommand::m_nodeId
private

Definition at line 142 of file BTEditorCommand.h.

Referenced by Execute(), GetDescription(), and Undo().

◆ m_nodeID

int32_t Olympe::DeleteNodeCommand::m_nodeID
private

Definition at line 92 of file UndoRedoStack.h.

Referenced by Execute().

◆ m_savedConnections

std::vector<Connection> Olympe::DeleteNodeCommand::m_savedConnections
private

Definition at line 150 of file BTEditorCommand.h.

Referenced by DeleteNodeCommand(), and Undo().

◆ m_savedDataConns

std::vector<DataPinConnection> Olympe::DeleteNodeCommand::m_savedDataConns
private

Definition at line 95 of file UndoRedoStack.h.

Referenced by Execute(), and Undo().

◆ m_savedExecConns

std::vector<ExecPinConnection> Olympe::DeleteNodeCommand::m_savedExecConns
private

Definition at line 94 of file UndoRedoStack.h.

Referenced by Execute(), and Undo().

◆ m_savedNode [1/2]

BTNode Olympe::DeleteNodeCommand::m_savedNode
private

Definition at line 143 of file BTEditorCommand.h.

Referenced by DeleteNodeCommand(), Execute(), Undo(), and Undo().

◆ m_savedNode [2/2]

TaskNodeDefinition Olympe::DeleteNodeCommand::m_savedNode
private

Definition at line 93 of file UndoRedoStack.h.

◆ m_tree

BehaviorTreeAsset* Olympe::DeleteNodeCommand::m_tree
private

Definition at line 141 of file BTEditorCommand.h.

Referenced by Execute(), and Undo().


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