47 std::cout <<
"Command executed: " <<
m_UndoStack.back()->GetDescription() << std::endl;
67 std::cout <<
"Command undone: " <<
m_RedoStack.back()->GetDescription() << std::endl;
87 std::cout <<
"Command redone: " <<
m_UndoStack.back()->GetDescription() << std::endl;
149 float posX,
float posY,
150 const std::string& nodeName)
153 , m_NodeName(nodeName)
156 , m_CreatedNodeId(-1)
166 std::cerr <<
"CreateNodeCommand: Graph not found: " <<
m_GraphId << std::endl;
181 std::cerr <<
"CreateNodeCommand::Undo: Graph not found: " <<
m_GraphId << std::endl;
213 std::cerr <<
"DeleteNodeCommand: Graph not found: " <<
m_GraphId << std::endl;
240 std::cerr <<
"DeleteNodeCommand::Undo: Graph not found: " <<
m_GraphId << std::endl;
250 int nodeId =
graph->CreateNode(type,
261 return "Delete Node " + std::to_string(
m_NodeId);
317 return "Move Node " + std::to_string(
m_NodeId);
326 , m_ParentId(parentId)
360 , m_ParentId(parentId)
434 , m_CreatedNodeId(-1)
443 std::cerr <<
"DuplicateNodeCommand: Graph not found: " <<
m_GraphId << std::endl;
451 std::cerr <<
"DuplicateNodeCommand: Source node not found: " <<
m_SourceNodeId << std::endl;
576 return "Edit Node " + std::to_string(
m_NodeId);
ComponentTypeID GetComponentTypeID_Static()
std::string GetNextRedoDescription() const
std::vector< std::unique_ptr< EditorCommand > > m_UndoStack
std::vector< std::string > GetRedoStackDescriptions() const
std::vector< std::unique_ptr< EditorCommand > > m_RedoStack
const EditorCommand * GetLastCommand() const
void ExecuteCommand(std::unique_ptr< EditorCommand > cmd)
std::string GetLastCommandDescription() const
std::vector< std::string > GetUndoStackDescriptions() const
std::string GetDescription() const override
CreateNodeCommand(const std::string &graphId, const std::string &nodeType, float posX, float posY, const std::string &nodeName="")
void Undo() override
Undo the command.
void Execute() override
Execute the command.
std::string GetDescription() const override
Get a human-readable description of the command.
DeleteNodeCommand(BehaviorTreeAsset *tree, uint32_t nodeId)
std::string GetDescription() const override
DuplicateNodeCommand(const std::string &graphId, int sourceNodeId)
std::string GetDescription() const override
EditNodeCommand(const std::string &graphId, int nodeId, const std::string &oldName, const std::string &newName, const std::string &oldSubtype, const std::string &newSubtype)
EditorCommand - Base class for all undoable editor commands Implements command pattern for undo/redo ...
virtual std::string GetDescription() const =0
std::string GetDescription() const override
LinkNodesCommand(const std::string &graphId, int parentId, int childId)
std::string GetDescription() const override
Get a human-readable description of the command.
void Undo() override
Undo the command.
MoveNodeCommand(BehaviorTreeAsset *tree, uint32_t nodeId, const Vector &oldPos, const Vector &newPos)
void Execute() override
Execute the command.
NodeGraph * GetGraph(int graphId)
static NodeGraphManager & Get()
bool UnlinkNodes(int parentId, int childId)
bool DeleteNode(int nodeId)
bool LinkNodes(int parentId, int childId)
bool SetNodeParameter(int nodeId, const std::string ¶mName, const std::string &value)
std::string GetDescription() const override
SetParameterCommand(const std::string &graphId, int nodeId, const std::string ¶mName, const std::string &oldValue, const std::string &newValue)
std::string GetDescription() const override
UnlinkNodesCommand(const std::string &graphId, int parentId, int childId)
const char * NodeTypeToString(NodeType type)
NodeType StringToNodeType(const std::string &str)