diff options
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 69 |
1 files changed, 30 insertions, 39 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index c5fe89e35d..3059ce445c 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -122,12 +122,6 @@ int EditorSelectionHistory::get_history_pos() { return current_elem_idx; } -bool EditorSelectionHistory::is_history_obj_inspector_only(int p_obj) const { - ERR_FAIL_INDEX_V(p_obj, history.size(), false); - ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), false); - return history[p_obj].path[history[p_obj].level].inspector_only; -} - ObjectID EditorSelectionHistory::get_history_obj(int p_obj) const { ERR_FAIL_INDEX_V(p_obj, history.size(), ObjectID()); ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), ObjectID()); @@ -351,18 +345,6 @@ void EditorData::apply_changes_in_editors() { } } -void EditorData::save_editor_global_states() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->save_global_state(); - } -} - -void EditorData::restore_editor_global_states() { - for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->restore_global_state(); - } -} - void EditorData::paste_object_params(Object *p_object) { ERR_FAIL_NULL(p_object); undo_redo_manager->create_action(TTR("Paste Params")); @@ -390,7 +372,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 +381,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 +407,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); } @@ -998,6 +976,8 @@ void EditorData::script_class_set_name(const String &p_path, const StringName &p } void EditorData::script_class_save_icon_paths() { + Array script_classes = ProjectSettings::get_singleton()->get_global_class_list(); + Dictionary d; for (const KeyValue<StringName, String> &E : _script_class_icon_paths) { if (ScriptServer::is_global_class(E.key)) { @@ -1005,27 +985,20 @@ void EditorData::script_class_save_icon_paths() { } } - Dictionary old; - if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { - old = GLOBAL_GET("_global_script_class_icons"); - } - if ((!old.is_empty() || d.is_empty()) && d.hash() == old.hash()) { - return; - } - - if (d.is_empty()) { - if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { - ProjectSettings::get_singleton()->clear("_global_script_class_icons"); + for (int i = 0; i < script_classes.size(); i++) { + Dictionary d2 = script_classes[i]; + if (!d2.has("class")) { + continue; } - } else { - ProjectSettings::get_singleton()->set("_global_script_class_icons", d); + d2["icon"] = d.get(d2["class"], ""); } - ProjectSettings::get_singleton()->save(); + ProjectSettings::get_singleton()->store_global_class_list(script_classes); } void EditorData::script_class_load_icon_paths() { script_class_clear_icon_paths(); +#ifndef DISABLE_DEPRECATED if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { Dictionary d = GLOBAL_GET("_global_script_class_icons"); List<Variant> keys; @@ -1038,15 +1011,33 @@ void EditorData::script_class_load_icon_paths() { String path = ScriptServer::get_global_class_path(name); script_class_set_name(path, name); } + ProjectSettings::get_singleton()->clear("_global_script_class_icons"); + } +#endif + + Array script_classes = ProjectSettings::get_singleton()->get_global_class_list(); + for (int i = 0; i < script_classes.size(); i++) { + Dictionary d = script_classes[i]; + if (!d.has("class") || !d.has("path") || !d.has("icon")) { + continue; + } + + String name = d["class"]; + _script_class_icon_paths[name] = d["icon"]; + script_class_set_name(d["path"], name); } } 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) { |