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

Command to paste nodes from clipboard with offset. More...

#include <BTGraphCommands.h>

+ Inheritance diagram for Olympe::PasteNodesCommand:
+ Collaboration diagram for Olympe::PasteNodesCommand:

Public Member Functions

 PasteNodesCommand (NodeGraph *graph, float offsetX=30.0f, float offsetY=30.0f)
 
virtual ~PasteNodesCommand ()=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
 
float m_offsetX
 
float m_offsetY
 
std::vector< intm_pastedNodeIds
 
std::map< int, intm_idMapping
 

Detailed Description

Command to paste nodes from clipboard with offset.

Definition at line 47 of file BTGraphCommands.h.

Constructor & Destructor Documentation

◆ PasteNodesCommand()

Olympe::PasteNodesCommand::PasteNodesCommand ( NodeGraph graph,
float  offsetX = 30.0f,
float  offsetY = 30.0f 
)

Definition at line 40 of file BTGraphCommands.cpp.

◆ ~PasteNodesCommand()

virtual Olympe::PasteNodesCommand::~PasteNodesCommand ( )
virtualdefault

Member Function Documentation

◆ Execute()

bool Olympe::PasteNodesCommand::Execute ( )
overridevirtual

Execute the command (forward operation)

Returns
true if execution succeeded

Implements Olympe::GraphCommand.

Definition at line 45 of file BTGraphCommands.cpp.

References m_graph, m_offsetX, m_offsetY, m_pastedNodeIds, and Olympe::NodeGraph::PasteNodesFromClipboard().

+ Here is the call graph for this function:

◆ GetDescription()

std::string Olympe::PasteNodesCommand::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 68 of file BTGraphCommands.cpp.

References m_pastedNodeIds.

◆ Undo()

bool Olympe::PasteNodesCommand::Undo ( )
overridevirtual

Undo the command (reverse operation)

Returns
true if undo succeeded

Implements Olympe::GraphCommand.

Definition at line 54 of file BTGraphCommands.cpp.

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

+ Here is the call graph for this function:

Member Data Documentation

◆ m_graph

NodeGraph* Olympe::PasteNodesCommand::m_graph
private

Definition at line 58 of file BTGraphCommands.h.

Referenced by Execute(), and Undo().

◆ m_idMapping

std::map<int, int> Olympe::PasteNodesCommand::m_idMapping
private

Definition at line 61 of file BTGraphCommands.h.

◆ m_offsetX

float Olympe::PasteNodesCommand::m_offsetX
private

Definition at line 59 of file BTGraphCommands.h.

Referenced by Execute().

◆ m_offsetY

float Olympe::PasteNodesCommand::m_offsetY
private

Definition at line 59 of file BTGraphCommands.h.

Referenced by Execute().

◆ m_pastedNodeIds

std::vector<int> Olympe::PasteNodesCommand::m_pastedNodeIds
private

Definition at line 60 of file BTGraphCommands.h.

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


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