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::EditNodePropertyCommand Class Reference

Records a property edit on a single node for undo/redo. More...

#include <UndoRedoStack.h>

+ Inheritance diagram for Olympe::EditNodePropertyCommand:
+ Collaboration diagram for Olympe::EditNodePropertyCommand:

Public Member Functions

 EditNodePropertyCommand (int32_t nodeID, const std::string &propertyKey, const PropertyValue &oldValue, const PropertyValue &newValue)
 
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
 Returns a short human-readable description (e.g.
 
- Public Member Functions inherited from Olympe::ICommand
virtual ~ICommand ()=default
 

Static Private Member Functions

static void ApplyValue (TaskNodeDefinition &node, const std::string &key, const PropertyValue &value)
 Applies value to the named field of node.
 

Private Attributes

int32_t m_nodeID
 
std::string m_propertyKey
 
PropertyValue m_oldValue
 
PropertyValue m_newValue
 

Detailed Description

Records a property edit on a single node for undo/redo.

Covers all editable fields exposed by the Properties panel: NodeName, AtomicTaskID, DelaySeconds, ConditionID, BBKey, MathOperator, SubGraphPath.

Uses the "commit on release" pattern: the command is pushed only when the ImGui widget loses focus after an edit (IsItemDeactivatedAfterEdit), so a single undo entry is created per editing session, not one per keystroke.

Definition at line 228 of file UndoRedoStack.h.

Constructor & Destructor Documentation

◆ EditNodePropertyCommand()

Olympe::EditNodePropertyCommand::EditNodePropertyCommand ( int32_t  nodeID,
const std::string &  propertyKey,
const PropertyValue oldValue,
const PropertyValue newValue 
)

Definition at line 323 of file UndoRedoStack.cpp.

Member Function Documentation

◆ ApplyValue()

void Olympe::EditNodePropertyCommand::ApplyValue ( TaskNodeDefinition node,
const std::string &  key,
const PropertyValue value 
)
staticprivate

Applies value to the named field of node.

Definition at line 334 of file UndoRedoStack.cpp.

References Olympe::PropertyValue::floatVal, GetComponentTypeID_Static(), and Olympe::PropertyValue::strVal.

Referenced by Execute(), and Undo().

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

◆ Execute()

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

Applies the command to the graph.

Implements Olympe::ICommand.

Definition at line 354 of file UndoRedoStack.cpp.

References ApplyValue(), GetComponentTypeID_Static(), m_newValue, m_nodeID, and m_propertyKey.

+ Here is the call graph for this function:

◆ GetDescription()

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

Returns a short human-readable description (e.g.

"Add Node #3").

Implements Olympe::ICommand.

Definition at line 380 of file UndoRedoStack.cpp.

References GetComponentTypeID_Static(), m_nodeID, and m_propertyKey.

+ Here is the call graph for this function:

◆ Undo()

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

Reverses the command on the graph.

Implements Olympe::ICommand.

Definition at line 367 of file UndoRedoStack.cpp.

References ApplyValue(), GetComponentTypeID_Static(), m_nodeID, m_oldValue, and m_propertyKey.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_newValue

PropertyValue Olympe::EditNodePropertyCommand::m_newValue
private

Definition at line 243 of file UndoRedoStack.h.

Referenced by Execute().

◆ m_nodeID

int32_t Olympe::EditNodePropertyCommand::m_nodeID
private

Definition at line 240 of file UndoRedoStack.h.

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

◆ m_oldValue

PropertyValue Olympe::EditNodePropertyCommand::m_oldValue
private

Definition at line 242 of file UndoRedoStack.h.

Referenced by Undo().

◆ m_propertyKey

std::string Olympe::EditNodePropertyCommand::m_propertyKey
private

Definition at line 241 of file UndoRedoStack.h.

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


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