diff options
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index e593d652ad..4b9b828e79 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -1,32 +1,32 @@ -/*************************************************************************/ -/* editor_data.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ +/**************************************************************************/ +/* editor_data.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ #include "editor_data.h" @@ -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) { |