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

Command to move a node. More...

#include <BTEditorCommand.h>

+ Inheritance diagram for Olympe::MoveNodeCommand:
+ Collaboration diagram for Olympe::MoveNodeCommand:

Public Member Functions

 MoveNodeCommand (BehaviorTreeAsset *tree, uint32_t nodeId, const Vector &oldPos, const Vector &newPos)
 
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.
 
 MoveNodeCommand (int32_t nodeID, float oldX, float oldY, float newX, float newY)
 
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
 

Static Private Member Functions

static void SetNodePos (TaskGraphTemplate &graph, int32_t nodeID, float x, float y)
 

Private Attributes

BehaviorTreeAssetm_tree
 
uint32_t m_nodeId
 
Vector m_oldPosition
 
Vector m_newPosition
 
int32_t m_nodeID
 
float m_oldX
 
float m_oldY
 
float m_newX
 
float m_newY
 

Detailed Description

Command to move a node.

Records a "move node" (position change) for undo/redo.

Node position is stored in the Parameters map under the keys "__posX" and "__posY" (editor-internal convention).

Definition at line 157 of file BTEditorCommand.h.

Constructor & Destructor Documentation

◆ MoveNodeCommand() [1/2]

Olympe::MoveNodeCommand::MoveNodeCommand ( BehaviorTreeAsset tree,
uint32_t  nodeId,
const Vector oldPos,
const Vector newPos 
)

Definition at line 236 of file BTEditorCommand.cpp.

◆ MoveNodeCommand() [2/2]

Olympe::MoveNodeCommand::MoveNodeCommand ( int32_t  nodeID,
float  oldX,
float  oldY,
float  newX,
float  newY 
)

Definition at line 129 of file UndoRedoStack.cpp.

Member Function Documentation

◆ Execute() [1/2]

void Olympe::MoveNodeCommand::Execute ( )
overridevirtual

Execute the command.

Implements Olympe::BTEditorCommand.

Definition at line 245 of file BTEditorCommand.cpp.

References m_nodeId.

◆ Execute() [2/2]

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

Applies the command to the graph.

Implements Olympe::ICommand.

Definition at line 158 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), m_newX, m_newY, m_nodeID, and SetNodePos().

+ Here is the call graph for this function:

◆ GetDescription() [1/2]

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

Get a human-readable description of the command.

Implements Olympe::BTEditorCommand.

Definition at line 257 of file BTEditorCommand.cpp.

References m_nodeId.

◆ GetDescription() [2/2]

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

Get a human-readable description of the command.

Implements Olympe::BTEditorCommand.

◆ SetNodePos()

void Olympe::MoveNodeCommand::SetNodePos ( TaskGraphTemplate graph,
int32_t  nodeID,
float  x,
float  y 
)
staticprivate

Definition at line 138 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), Olympe::Literal, and Olympe::ParameterBinding::Type.

Referenced by Execute(), and Undo().

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

◆ Undo() [1/2]

void Olympe::MoveNodeCommand::Undo ( )
overridevirtual

Undo the command.

Implements Olympe::BTEditorCommand.

Definition at line 252 of file BTEditorCommand.cpp.

References m_nodeId.

◆ Undo() [2/2]

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

Reverses the command on the graph.

Implements Olympe::ICommand.

Definition at line 163 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), m_nodeID, m_oldX, m_oldY, and SetNodePos().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_newPosition

Vector Olympe::MoveNodeCommand::m_newPosition
private

Definition at line 170 of file BTEditorCommand.h.

◆ m_newX

float Olympe::MoveNodeCommand::m_newX
private

Definition at line 117 of file UndoRedoStack.h.

Referenced by Execute().

◆ m_newY

float Olympe::MoveNodeCommand::m_newY
private

Definition at line 117 of file UndoRedoStack.h.

Referenced by Execute().

◆ m_nodeId

uint32_t Olympe::MoveNodeCommand::m_nodeId
private

Definition at line 168 of file BTEditorCommand.h.

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

◆ m_nodeID

int32_t Olympe::MoveNodeCommand::m_nodeID
private

Definition at line 115 of file UndoRedoStack.h.

Referenced by Execute(), and Undo().

◆ m_oldPosition

Vector Olympe::MoveNodeCommand::m_oldPosition
private

Definition at line 169 of file BTEditorCommand.h.

◆ m_oldX

float Olympe::MoveNodeCommand::m_oldX
private

Definition at line 116 of file UndoRedoStack.h.

Referenced by Undo().

◆ m_oldY

float Olympe::MoveNodeCommand::m_oldY
private

Definition at line 116 of file UndoRedoStack.h.

Referenced by Undo().

◆ m_tree

BehaviorTreeAsset* Olympe::MoveNodeCommand::m_tree
private

Definition at line 167 of file BTEditorCommand.h.


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