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 /editor/editor_data.cpp | |
parent | 91fedb60de6011434938499a9d4a7d4fd1cd4f06 (diff) | |
download | redot-engine-b58111588a62fcdd238f93129cd48a1dbb1d5237.tar.gz |
Add EditorUndoRedoManager singleton
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index c5fe89e35d..4b9b828e79 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -390,7 +390,7 @@ void EditorData::set_scene_as_saved(int p_idx) { } ERR_FAIL_INDEX(p_idx, edited_scene.size()); - get_undo_redo()->set_history_as_saved(edited_scene[p_idx].history_id); + undo_redo_manager->set_history_as_saved(edited_scene[p_idx].history_id); } bool EditorData::is_scene_changed(int p_idx) { @@ -399,7 +399,7 @@ bool EditorData::is_scene_changed(int p_idx) { } ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), false); - uint64_t current_scene_version = get_undo_redo()->get_or_create_history(edited_scene[p_idx].history_id).undo_redo->get_version(); + uint64_t current_scene_version = undo_redo_manager->get_or_create_history(edited_scene[p_idx].history_id).undo_redo->get_version(); bool is_changed = edited_scene[p_idx].last_checked_version != current_scene_version; edited_scene.write[p_idx].last_checked_version = current_scene_version; return is_changed; @@ -425,10 +425,6 @@ int EditorData::get_scene_history_id(int p_idx) const { return edited_scene[p_idx].history_id; } -Ref<EditorUndoRedoManager> &EditorData::get_undo_redo() { - return undo_redo_manager; -} - void EditorData::add_undo_redo_inspector_hook_callback(Callable p_callable) { undo_redo_callbacks.push_back(p_callable); } @@ -1043,10 +1039,14 @@ void EditorData::script_class_load_icon_paths() { EditorData::EditorData() { current_edited_scene = -1; - undo_redo_manager.instantiate(); + undo_redo_manager = memnew(EditorUndoRedoManager); script_class_load_icon_paths(); } +EditorData::~EditorData() { + memdelete(undo_redo_manager); +} + /////////////////////////////////////////////////////////////////////////////// void EditorSelection::_node_removed(Node *p_node) { |