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

Command to duplicate selected nodes (copy + paste in one action) More...

#include <BTGraphCommands.h>

+ Inheritance diagram for Olympe::DuplicateNodeCommand:
+ Collaboration diagram for Olympe::DuplicateNodeCommand:

Public Member Functions

 DuplicateNodeCommand (NodeGraph *graph, const std::vector< int > &nodeIds, float offsetX=30.0f, float offsetY=30.0f)
 
virtual ~DuplicateNodeCommand ()=default
 
bool Execute () override
 Execute the command (forward operation)
 
bool Undo () override
 Undo the command (reverse operation)
 
std::string GetDescription () const override
 Get a human-readable description of the command.
 
- Public Member Functions inherited from Olympe::GraphCommand
virtual ~GraphCommand ()=default
 
virtual bool CanMergeWith (const GraphCommand &other) const
 Check if this command can be merged with another Used for combining consecutive similar commands (e.g., multiple position changes)
 
virtual bool MergeWith (const GraphCommand &other)
 Merge this command with another Called only if CanMergeWith returned true.
 

Private Attributes

NodeGraphm_graph
 
std::vector< intm_originalNodeIds
 
std::vector< intm_duplicatedNodeIds
 
float m_offsetX
 
float m_offsetY
 

Detailed Description

Command to duplicate selected nodes (copy + paste in one action)

Definition at line 68 of file BTGraphCommands.h.

Constructor & Destructor Documentation

◆ DuplicateNodeCommand()

Olympe::DuplicateNodeCommand::DuplicateNodeCommand ( NodeGraph graph,
const std::vector< int > &  nodeIds,
float  offsetX = 30.0f,
float  offsetY = 30.0f 
)

Definition at line 74 of file BTGraphCommands.cpp.

◆ ~DuplicateNodeCommand()

virtual Olympe::DuplicateNodeCommand::~DuplicateNodeCommand ( )
virtualdefault

Member Function Documentation

◆ Execute()

bool Olympe::DuplicateNodeCommand::Execute ( )
overridevirtual

Execute the command (forward operation)

Returns
true if execution succeeded

Implements Olympe::GraphCommand.

Definition at line 79 of file BTGraphCommands.cpp.

References Olympe::NodeGraph::DuplicateNodes(), m_duplicatedNodeIds, m_graph, m_offsetX, m_offsetY, and m_originalNodeIds.

+ Here is the call graph for this function:

◆ GetDescription()

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

Get a human-readable description of the command.

Returns
Command description for UI display (e.g., "Create Action Node")

Implements Olympe::GraphCommand.

Definition at line 102 of file BTGraphCommands.cpp.

References m_originalNodeIds.

◆ Undo()

bool Olympe::DuplicateNodeCommand::Undo ( )
overridevirtual

Undo the command (reverse operation)

Returns
true if undo succeeded

Implements Olympe::GraphCommand.

Definition at line 88 of file BTGraphCommands.cpp.

References Olympe::NodeGraph::DeleteNode(), m_duplicatedNodeIds, and m_graph.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_duplicatedNodeIds

std::vector<int> Olympe::DuplicateNodeCommand::m_duplicatedNodeIds
private

Definition at line 81 of file BTGraphCommands.h.

Referenced by Execute(), and Undo().

◆ m_graph

NodeGraph* Olympe::DuplicateNodeCommand::m_graph
private

Definition at line 79 of file BTGraphCommands.h.

Referenced by Execute(), and Undo().

◆ m_offsetX

float Olympe::DuplicateNodeCommand::m_offsetX
private

Definition at line 82 of file BTGraphCommands.h.

Referenced by Execute().

◆ m_offsetY

float Olympe::DuplicateNodeCommand::m_offsetY
private

Definition at line 82 of file BTGraphCommands.h.

Referenced by Execute().

◆ m_originalNodeIds

std::vector<int> Olympe::DuplicateNodeCommand::m_originalNodeIds
private

Definition at line 80 of file BTGraphCommands.h.

Referenced by Execute(), and GetDescription().


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