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

Command to add a node to the tree. More...

#include <BTEditorCommand.h>

+ Inheritance diagram for Olympe::AddNodeCommand:
+ Collaboration diagram for Olympe::AddNodeCommand:

Public Member Functions

 AddNodeCommand (BehaviorTreeAsset *tree, BTNodeType type, const std::string &name, const Vector &position)
 
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.
 
 AddNodeCommand (const TaskNodeDefinition &nodeDef)
 
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
 
BTNodeType m_nodeType
 
std::string m_nodeName
 
Vector m_position
 
uint32_t m_createdNodeId
 
TaskNodeDefinition m_node
 

Detailed Description

Command to add a node to the tree.

Records an "add node" operation for undo/redo.

Definition at line 110 of file BTEditorCommand.h.

Constructor & Destructor Documentation

◆ AddNodeCommand() [1/2]

Olympe::AddNodeCommand::AddNodeCommand ( BehaviorTreeAsset tree,
BTNodeType  type,
const std::string &  name,
const Vector position 
)

Definition at line 102 of file BTEditorCommand.cpp.

◆ AddNodeCommand() [2/2]

Olympe::AddNodeCommand::AddNodeCommand ( const TaskNodeDefinition nodeDef)
explicit

Definition at line 21 of file UndoRedoStack.cpp.

Member Function Documentation

◆ Execute() [1/2]

void Olympe::AddNodeCommand::Execute ( )
overridevirtual

Execute the command.

Implements Olympe::BTEditorCommand.

Definition at line 112 of file BTEditorCommand.cpp.

References BehaviorTreeAsset::AddNode(), m_createdNodeId, m_nodeName, m_nodeType, m_position, and m_tree.

+ Here is the call graph for this function:

◆ Execute() [2/2]

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

Applies the command to the graph.

Implements Olympe::ICommand.

Definition at line 26 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), and m_node.

+ Here is the call graph for this function:

◆ GetDescription() [1/2]

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

Get a human-readable description of the command.

Implements Olympe::BTEditorCommand.

Definition at line 130 of file BTEditorCommand.cpp.

References m_nodeName.

◆ GetDescription() [2/2]

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

Get a human-readable description of the command.

Implements Olympe::BTEditorCommand.

◆ Undo() [1/2]

void Olympe::AddNodeCommand::Undo ( )
overridevirtual

Undo the command.

Implements Olympe::BTEditorCommand.

Definition at line 121 of file BTEditorCommand.cpp.

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

+ Here is the call graph for this function:

◆ Undo() [2/2]

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

Reverses the command on the graph.

Implements Olympe::ICommand.

Definition at line 32 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_createdNodeId

uint32_t Olympe::AddNodeCommand::m_createdNodeId
private

Definition at line 124 of file BTEditorCommand.h.

Referenced by Execute(), and Undo().

◆ m_node

TaskNodeDefinition Olympe::AddNodeCommand::m_node
private

Definition at line 71 of file UndoRedoStack.h.

Referenced by Execute().

◆ m_nodeName

std::string Olympe::AddNodeCommand::m_nodeName
private

Definition at line 122 of file BTEditorCommand.h.

Referenced by Execute(), and GetDescription().

◆ m_nodeType

BTNodeType Olympe::AddNodeCommand::m_nodeType
private

Definition at line 121 of file BTEditorCommand.h.

Referenced by Execute().

◆ m_position

Vector Olympe::AddNodeCommand::m_position
private

Definition at line 123 of file BTEditorCommand.h.

Referenced by Execute().

◆ m_tree

BehaviorTreeAsset* Olympe::AddNodeCommand::m_tree
private

Definition at line 120 of file BTEditorCommand.h.

Referenced by Execute(), and Undo().


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