diff options
author | kobewi <kobewi4e@gmail.com> | 2022-12-23 23:53:16 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-01-16 01:11:52 +0100 |
commit | b58111588a62fcdd238f93129cd48a1dbb1d5237 (patch) | |
tree | 25c5154a456d471932ca9d27ff46dd0aec663665 /modules | |
parent | 91fedb60de6011434938499a9d4a7d4fd1cd4f06 (diff) |
Add EditorUndoRedoManager singleton
Diffstat (limited to 'modules')
11 files changed, 20 insertions, 23 deletions
diff --git a/modules/csg/editor/csg_gizmos.cpp b/modules/csg/editor/csg_gizmos.cpp index 61787691a3..2c533cb36d 100644 --- a/modules/csg/editor/csg_gizmos.cpp +++ b/modules/csg/editor/csg_gizmos.cpp @@ -217,7 +217,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); + EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton(); ur->create_action(TTR("Change Sphere Shape Radius")); ur->add_do_method(s, "set_radius", s->get_radius()); ur->add_undo_method(s, "set_radius", p_restore); @@ -231,7 +231,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); + EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton(); ur->create_action(TTR("Change Box Shape Size")); ur->add_do_method(s, "set_size", s->get_size()); ur->add_undo_method(s, "set_size", p_restore); @@ -249,7 +249,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); + EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton(); if (p_id == 0) { ur->create_action(TTR("Change Cylinder Radius")); ur->add_do_method(s, "set_radius", s->get_radius()); @@ -274,7 +274,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); + EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton(); if (p_id == 0) { ur->create_action(TTR("Change Torus Inner Radius")); ur->add_do_method(s, "set_inner_radius", s->get_inner_radius()); diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 67bb99de16..183190460e 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -461,7 +461,7 @@ void GridMapEditor::_delete_selection() { return; } - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("GridMap Delete Selection")); for (int i = selection.begin.x; i <= selection.end.x; i++) { for (int j = selection.begin.y; j <= selection.end.y; j++) { @@ -482,7 +482,7 @@ void GridMapEditor::_fill_selection() { return; } - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("GridMap Fill Selection")); for (int i = selection.begin.x; i <= selection.end.x; i++) { for (int j = selection.begin.y; j <= selection.end.y; j++) { @@ -576,7 +576,7 @@ void GridMapEditor::_do_paste() { rot = node->get_basis_with_orthogonal_index(paste_indicator.orientation); Vector3 ofs = paste_indicator.current - paste_indicator.click; - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("GridMap Paste Selection")); for (const ClipboardItem &item : clipboard_items) { @@ -664,7 +664,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D } else { if ((mb->get_button_index() == MouseButton::RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MouseButton::LEFT && input_action == INPUT_PAINT)) { if (set_items.size()) { - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("GridMap Paint")); for (const SetItem &si : set_items) { undo_redo->add_do_method(node, "set_cell_item", si.position, si.new_value, si.new_orientation); @@ -686,7 +686,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D } if (mb->get_button_index() == MouseButton::LEFT && input_action == INPUT_SELECT) { - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("GridMap Selection")); undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end); undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end); diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index 4ab41cfcb0..9b071ecc02 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -142,7 +142,7 @@ void ReplicationEditor::_add_sync_property(String p_path) { return; } - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("Add property to synchronizer")); if (config.is_null()) { @@ -357,7 +357,7 @@ void ReplicationEditor::_tree_item_edited() { int column = tree->get_edited_column(); ERR_FAIL_COND(column < 1 || column > 2); const NodePath prop = ti->get_metadata(0); - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); bool value = ti->is_checked(column); String method; if (column == 1) { @@ -397,7 +397,7 @@ void ReplicationEditor::_dialog_closed(bool p_confirmed) { int idx = config->property_get_index(prop); bool spawn = config->property_get_spawn(prop); bool sync = config->property_get_sync(prop); - Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("Remove Property")); undo_redo->add_do_method(config.ptr(), "remove_property", prop); undo_redo->add_undo_method(config.ptr(), "add_property", prop, idx); diff --git a/modules/openxr/editor/openxr_action_editor.cpp b/modules/openxr/editor/openxr_action_editor.cpp index e3fe06c6f7..586b0b0697 100644 --- a/modules/openxr/editor/openxr_action_editor.cpp +++ b/modules/openxr/editor/openxr_action_editor.cpp @@ -29,7 +29,6 @@ /**************************************************************************/ #include "openxr_action_editor.h" -#include "editor/editor_node.h" void OpenXRActionEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_do_set_name", "name"), &OpenXRActionEditor::_do_set_name); @@ -125,7 +124,7 @@ void OpenXRActionEditor::_on_remove_action() { } OpenXRActionEditor::OpenXRActionEditor(Ref<OpenXRAction> p_action) { - undo_redo = EditorNode::get_undo_redo(); + undo_redo = EditorUndoRedoManager::get_singleton(); action = p_action; set_h_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/modules/openxr/editor/openxr_action_editor.h b/modules/openxr/editor/openxr_action_editor.h index 8af5448aed..765b3ef378 100644 --- a/modules/openxr/editor/openxr_action_editor.h +++ b/modules/openxr/editor/openxr_action_editor.h @@ -43,7 +43,7 @@ class OpenXRActionEditor : public HBoxContainer { GDCLASS(OpenXRActionEditor, HBoxContainer); private: - Ref<EditorUndoRedoManager> undo_redo; + EditorUndoRedoManager *undo_redo; Ref<OpenXRAction> action; LineEdit *action_name = nullptr; diff --git a/modules/openxr/editor/openxr_action_map_editor.cpp b/modules/openxr/editor/openxr_action_map_editor.cpp index 12c95f8978..ad5a515a01 100644 --- a/modules/openxr/editor/openxr_action_map_editor.cpp +++ b/modules/openxr/editor/openxr_action_map_editor.cpp @@ -387,7 +387,7 @@ void OpenXRActionMapEditor::_clear_action_map() { } OpenXRActionMapEditor::OpenXRActionMapEditor() { - undo_redo = EditorNode::get_undo_redo(); + undo_redo = EditorUndoRedoManager::get_singleton(); set_custom_minimum_size(Size2(0.0, 300.0)); top_hb = memnew(HBoxContainer); diff --git a/modules/openxr/editor/openxr_action_map_editor.h b/modules/openxr/editor/openxr_action_map_editor.h index 47bfda3425..a04bae4a6e 100644 --- a/modules/openxr/editor/openxr_action_map_editor.h +++ b/modules/openxr/editor/openxr_action_map_editor.h @@ -48,7 +48,7 @@ class OpenXRActionMapEditor : public VBoxContainer { GDCLASS(OpenXRActionMapEditor, VBoxContainer); private: - Ref<EditorUndoRedoManager> undo_redo; + EditorUndoRedoManager *undo_redo; String edited_path; Ref<OpenXRActionMap> action_map; diff --git a/modules/openxr/editor/openxr_action_set_editor.cpp b/modules/openxr/editor/openxr_action_set_editor.cpp index 078d83f5f2..bcb0f5f8b1 100644 --- a/modules/openxr/editor/openxr_action_set_editor.cpp +++ b/modules/openxr/editor/openxr_action_set_editor.cpp @@ -29,7 +29,6 @@ /**************************************************************************/ #include "openxr_action_set_editor.h" -#include "editor/editor_node.h" #include "openxr_action_editor.h" void OpenXRActionSetEditor::_bind_methods() { @@ -212,7 +211,7 @@ void OpenXRActionSetEditor::set_focus_on_entry() { } OpenXRActionSetEditor::OpenXRActionSetEditor(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRActionSet> p_action_set) { - undo_redo = EditorNode::get_undo_redo(); + undo_redo = EditorUndoRedoManager::get_singleton(); action_map = p_action_map; action_set = p_action_set; diff --git a/modules/openxr/editor/openxr_action_set_editor.h b/modules/openxr/editor/openxr_action_set_editor.h index 6040f7fb4e..129f800abe 100644 --- a/modules/openxr/editor/openxr_action_set_editor.h +++ b/modules/openxr/editor/openxr_action_set_editor.h @@ -44,7 +44,7 @@ class OpenXRActionSetEditor : public HBoxContainer { GDCLASS(OpenXRActionSetEditor, HBoxContainer); private: - Ref<EditorUndoRedoManager> undo_redo; + EditorUndoRedoManager *undo_redo; Ref<OpenXRActionMap> action_map; Ref<OpenXRActionSet> action_set; diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.cpp b/modules/openxr/editor/openxr_interaction_profile_editor.cpp index 76b0ae5a3c..6a848dd430 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.cpp +++ b/modules/openxr/editor/openxr_interaction_profile_editor.cpp @@ -29,7 +29,6 @@ /**************************************************************************/ #include "openxr_interaction_profile_editor.h" -#include "editor/editor_node.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/label.h" @@ -141,7 +140,7 @@ void OpenXRInteractionProfileEditorBase::remove_all_bindings_for_action(Ref<Open } OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile) { - undo_redo = EditorNode::get_undo_redo(); + undo_redo = EditorUndoRedoManager::get_singleton(); action_map = p_action_map; interaction_profile = p_interaction_profile; diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.h b/modules/openxr/editor/openxr_interaction_profile_editor.h index 73dba71cbd..fa25a000a9 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.h +++ b/modules/openxr/editor/openxr_interaction_profile_editor.h @@ -43,7 +43,7 @@ class OpenXRInteractionProfileEditorBase : public ScrollContainer { GDCLASS(OpenXRInteractionProfileEditorBase, ScrollContainer); protected: - Ref<EditorUndoRedoManager> undo_redo; + EditorUndoRedoManager *undo_redo; Ref<OpenXRInteractionProfile> interaction_profile; Ref<OpenXRActionMap> action_map; |