You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Add EditorUndoRedoManager singleton
This commit is contained in:
@@ -246,7 +246,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||
Ref<AnimationNode> an = state_machine->get_node(selected_node);
|
||||
updating = true;
|
||||
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Move Node"));
|
||||
|
||||
for (int i = 0; i < node_rects.size(); i++) {
|
||||
@@ -543,7 +543,7 @@ void AnimationNodeStateMachineEditor::_group_selected_nodes() {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action("Group");
|
||||
|
||||
// Move selected nodes to the new state machine
|
||||
@@ -658,7 +658,7 @@ void AnimationNodeStateMachineEditor::_ungroup_selected_nodes() {
|
||||
Vector<TransitionUR> transitions_ur;
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action("Ungroup");
|
||||
|
||||
// Move all child nodes to current state machine
|
||||
@@ -935,7 +935,7 @@ void AnimationNodeStateMachineEditor::_stop_connecting() {
|
||||
|
||||
void AnimationNodeStateMachineEditor::_delete_selected() {
|
||||
TreeItem *item = delete_tree->get_next_selected(nullptr);
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
while (item) {
|
||||
if (!updating) {
|
||||
updating = true;
|
||||
@@ -963,7 +963,7 @@ void AnimationNodeStateMachineEditor::_delete_all() {
|
||||
selected_multi_transition = TransitionLine();
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action("Transition(s) Removed");
|
||||
_erase_selected(true);
|
||||
for (int i = 0; i < multi_transitions.size(); i++) {
|
||||
@@ -1043,7 +1043,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Add Node and Transition"));
|
||||
undo_redo->add_do_method(state_machine.ptr(), "add_node", name, node, add_node_pos);
|
||||
undo_redo->add_undo_method(state_machine.ptr(), "remove_node", name);
|
||||
@@ -1070,7 +1070,7 @@ void AnimationNodeStateMachineEditor::_add_animation_type(int p_index) {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Add Node and Transition"));
|
||||
undo_redo->add_do_method(state_machine.ptr(), "add_node", name, anim, add_node_pos);
|
||||
undo_redo->add_undo_method(state_machine.ptr(), "remove_node", name);
|
||||
@@ -1100,7 +1100,7 @@ void AnimationNodeStateMachineEditor::_add_transition(const bool p_nested_action
|
||||
tr->set_advance_mode(auto_advance->is_pressed() ? AnimationNodeStateMachineTransition::AdvanceMode::ADVANCE_MODE_AUTO : AnimationNodeStateMachineTransition::AdvanceMode::ADVANCE_MODE_ENABLED);
|
||||
tr->set_switch_mode(AnimationNodeStateMachineTransition::SwitchMode(switch_mode->get_selected()));
|
||||
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
if (!p_nested_action) {
|
||||
updating = true;
|
||||
undo_redo->create_action(TTR("Add Transition"));
|
||||
@@ -1778,7 +1778,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Node Renamed"));
|
||||
undo_redo->add_do_method(state_machine.ptr(), "rename_node", prev_name, name);
|
||||
undo_redo->add_undo_method(state_machine.ptr(), "rename_node", name, prev_name);
|
||||
@@ -1813,7 +1813,7 @@ void AnimationNodeStateMachineEditor::_erase_selected(const bool p_nested_action
|
||||
if (!p_nested_action) {
|
||||
updating = true;
|
||||
}
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Node Removed"));
|
||||
|
||||
for (int i = 0; i < node_rects.size(); i++) {
|
||||
@@ -1882,7 +1882,7 @@ void AnimationNodeStateMachineEditor::_erase_selected(const bool p_nested_action
|
||||
if (!p_nested_action) {
|
||||
updating = true;
|
||||
}
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(TTR("Transition Removed"));
|
||||
undo_redo->add_do_method(state_machine.ptr(), "remove_transition", selected_transition_from, selected_transition_to);
|
||||
undo_redo->add_undo_method(state_machine.ptr(), "add_transition", selected_transition_from, selected_transition_to, tr);
|
||||
|
||||
Reference in New Issue
Block a user