You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Cleanup remaining EditorUndoRedoManager usages
This commit is contained in:
@@ -238,6 +238,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();
|
||||
undo_redo->create_action(TTR("Move Node"));
|
||||
|
||||
for (int i = 0; i < node_rects.size(); i++) {
|
||||
@@ -534,6 +535,7 @@ void AnimationNodeStateMachineEditor::_group_selected_nodes() {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action("Group");
|
||||
|
||||
// Move selected nodes to the new state machine
|
||||
@@ -648,6 +650,7 @@ void AnimationNodeStateMachineEditor::_ungroup_selected_nodes() {
|
||||
Vector<TransitionUR> transitions_ur;
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action("Ungroup");
|
||||
|
||||
// Move all child nodes to current state machine
|
||||
@@ -921,6 +924,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();
|
||||
while (item) {
|
||||
if (!updating) {
|
||||
updating = true;
|
||||
@@ -948,6 +952,7 @@ void AnimationNodeStateMachineEditor::_delete_all() {
|
||||
selected_multi_transition = TransitionLine();
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action("Transition(s) Removed");
|
||||
_erase_selected(true);
|
||||
for (int i = 0; i < multi_transitions.size(); i++) {
|
||||
@@ -1027,6 +1032,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
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);
|
||||
@@ -1053,6 +1059,7 @@ void AnimationNodeStateMachineEditor::_add_animation_type(int p_index) {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
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);
|
||||
@@ -1081,6 +1088,7 @@ void AnimationNodeStateMachineEditor::_add_transition(const bool p_nested_action
|
||||
tr.instantiate();
|
||||
tr->set_switch_mode(AnimationNodeStateMachineTransition::SwitchMode(transition_mode->get_selected()));
|
||||
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
if (!p_nested_action) {
|
||||
updating = true;
|
||||
undo_redo->create_action(TTR("Add Transition"));
|
||||
@@ -1745,6 +1753,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
|
||||
}
|
||||
|
||||
updating = true;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
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);
|
||||
@@ -1779,6 +1788,7 @@ void AnimationNodeStateMachineEditor::_erase_selected(const bool p_nested_action
|
||||
if (!p_nested_action) {
|
||||
updating = true;
|
||||
}
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Node Removed"));
|
||||
|
||||
for (int i = 0; i < node_rects.size(); i++) {
|
||||
@@ -1847,6 +1857,7 @@ void AnimationNodeStateMachineEditor::_erase_selected(const bool p_nested_action
|
||||
if (!p_nested_action) {
|
||||
updating = true;
|
||||
}
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
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);
|
||||
@@ -2013,8 +2024,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
|
||||
error_panel->add_child(error_label);
|
||||
error_panel->hide();
|
||||
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
|
||||
|
||||
menu = memnew(PopupMenu);
|
||||
@@ -2055,7 +2064,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
delete_window = memnew(ConfirmationDialog);
|
||||
delete_window->set_flag(Window::FLAG_RESIZE_DISABLED, true);
|
||||
|
||||
Reference in New Issue
Block a user