From 5767e12b56ad442800b5f17c6b295cbb630ecce2 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 16 Mar 2022 01:17:27 +0100 Subject: [PATCH] Removed editor feature profiles. --- core/project_settings.cpp | 29 +- core/project_settings.h | 4 - editor/create_dialog.cpp | 17 +- editor/create_dialog.h | 1 - editor/editor_feature_profile.cpp | 1029 ----------------------------- editor/editor_feature_profile.h | 184 ------ editor/editor_help_search.cpp | 103 ++- editor/editor_help_search.h | 2 - editor/editor_inspector.cpp | 31 +- editor/editor_inspector.h | 4 - editor/editor_node.cpp | 85 +-- editor/editor_node.h | 5 - editor/filesystem_dock.cpp | 36 - editor/filesystem_dock.h | 3 - editor/scene_tree_dock.cpp | 29 - editor/scene_tree_dock.h | 2 - main/main.cpp | 1 - 17 files changed, 46 insertions(+), 1519 deletions(-) delete mode 100644 editor/editor_feature_profile.cpp delete mode 100644 editor/editor_feature_profile.h diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 13c5a605f..c597ced7d 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -196,26 +196,6 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) { return true; } - if (!disable_feature_overrides) { - int dot = p_name.operator String().find("."); - if (dot != -1) { - Vector s = p_name.operator String().split("."); - - bool override_valid = false; - for (int i = 1; i < s.size(); i++) { - String feature = s[i].strip_edges(); - if (OS::get_singleton()->has_feature(feature) || custom_features.has(feature)) { - override_valid = true; - break; - } - } - - if (override_valid) { - feature_overrides[s[0]] = p_name; - } - } - } - if (props.has(p_name)) { if (!props[p_name].overridden) { props[p_name].variant = p_value; @@ -232,9 +212,7 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const { _THREAD_SAFE_METHOD_ StringName name = p_name; - if (!disable_feature_overrides && feature_overrides.has(name)) { - name = feature_overrides[name]; - } + if (!props.has(name)) { WARN_PRINT("Property not found: " + String(name)); return false; @@ -986,10 +964,6 @@ const Map &ProjectSettings::get_custom_property_info() return custom_prop_info; } -void ProjectSettings::set_disable_feature_overrides(bool p_disable) { - disable_feature_overrides = p_disable; -} - bool ProjectSettings::is_using_datapack() const { return using_datapack; } @@ -1050,7 +1024,6 @@ ProjectSettings::ProjectSettings() { singleton = this; last_order = NO_BUILTIN_ORDER_BASE; last_builtin_order = 0; - disable_feature_overrides = false; registering_order = true; Array events; diff --git a/core/project_settings.h b/core/project_settings.h index 877186c1a..e13b24ee5 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -112,12 +112,10 @@ protected: Map props; String resource_path; Map custom_prop_info; - bool disable_feature_overrides; bool using_datapack; List input_presets; Set custom_features; - Map feature_overrides; String project_data_dir_name; @@ -187,8 +185,6 @@ public: List get_input_presets() const { return input_presets; } - void set_disable_feature_overrides(bool p_disable); - bool is_using_datapack() const; void set_registering_order(bool p_enable); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index b7c2ea391..9780faec5 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -33,7 +33,6 @@ #include "core/class_db.h" #include "core/os/keyboard.h" #include "core/print_string.h" -#include "editor_feature_profile.h" #include "editor_help.h" #include "editor_node.h" #include "editor_scale.h" @@ -58,7 +57,7 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const St while (!f->eof_reached()) { String l = f->get_line().strip_edges(); String name = l.split(" ")[0]; - if ((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) && !_is_class_disabled_by_feature_profile(name)) { + if ((ClassDB::class_exists(name) || ScriptServer::is_global_class(name))) { TreeItem *ti = recent->create_item(root); ti->set_text(0, l); ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(name, icon_fallback)); @@ -263,15 +262,6 @@ bool CreateDialog::_is_type_prefered(const String &type) { return ed.script_class_is_parent(type, preferred_search_result_type); } -bool CreateDialog::_is_class_disabled_by_feature_profile(const StringName &p_class) { - Ref profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); - if (profile.is_null()) { - return false; - } - - return profile->is_class_disabled(p_class); -} - void CreateDialog::select_type(const String &p_type) { TreeItem *to_select; if (search_options_types.has(p_type)) { @@ -314,9 +304,6 @@ void CreateDialog::_update_search() { for (List::Element *I = type_list.front(); I; I = I->next()) { String type = I->get(); - if (_is_class_disabled_by_feature_profile(type)) { - continue; - } bool cpp_type = ClassDB::class_exists(type); if (base_type == "Node" && type.begins_with("Editor")) { @@ -612,7 +599,7 @@ void CreateDialog::_update_favorite_list() { for (int i = 0; i < favorite_list.size(); i++) { String l = favorite_list[i]; String name = l.split(" ")[0]; - if (!((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) && !_is_class_disabled_by_feature_profile(name))) { + if (!((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)))) { continue; } diff --git a/editor/create_dialog.h b/editor/create_dialog.h index 2327f771c..354ec10ec 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -84,7 +84,6 @@ class CreateDialog : public ConfirmationDialog { bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); - bool _is_class_disabled_by_feature_profile(const StringName &p_class); bool _is_type_prefered(const String &type); protected: diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp deleted file mode 100644 index 88f5224a6..000000000 --- a/editor/editor_feature_profile.cpp +++ /dev/null @@ -1,1029 +0,0 @@ -/*************************************************************************/ -/* editor_feature_profile.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. */ -/*************************************************************************/ - -#include "editor_feature_profile.h" -#include "core/io/json.h" -#include "core/os/dir_access.h" -#include "editor/editor_settings.h" -#include "editor_node.h" -#include "editor_property_name_processor.h" -#include "editor_scale.h" - -const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { - TTRC("3D Editor"), - TTRC("Script Editor"), - TTRC("Asset Library"), - TTRC("Scene Tree Editing"), - TTRC("Node Dock"), - TTRC("FileSystem Dock"), - TTRC("Import Dock"), -}; - -const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = { - TTRC("Allows to view and edit 3D scenes."), - TTRC("Allows to edit scripts using the integrated script editor."), - TTRC("Provides built-in access to the Asset Library."), - TTRC("Allows editing the node hierarchy in the Scene dock."), - TTRC("Allows to work with signals and groups of the node selected in the Scene dock."), - TTRC("Allows to browse the local file system via a dedicated dock."), - TTRC("Allows to configure import settings for individual assets. Requires the FileSystem dock to function."), -}; - -const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = { - "3d", - "script", - "asset_lib", - "scene_tree", - "node_dock", - "filesystem_dock", - "import_dock", -}; - -void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_disabled) { - if (p_disabled) { - disabled_classes.insert(p_class); - } else { - disabled_classes.erase(p_class); - } -} - -bool EditorFeatureProfile::is_class_disabled(const StringName &p_class) const { - if (p_class == StringName()) { - return false; - } - return disabled_classes.has(p_class) || is_class_disabled(ClassDB::get_parent_class_nocheck(p_class)); -} - -void EditorFeatureProfile::set_disable_class_editor(const StringName &p_class, bool p_disabled) { - if (p_disabled) { - disabled_editors.insert(p_class); - } else { - disabled_editors.erase(p_class); - } -} - -bool EditorFeatureProfile::is_class_editor_disabled(const StringName &p_class) const { - if (p_class == StringName()) { - return false; - } - return disabled_editors.has(p_class) || is_class_editor_disabled(ClassDB::get_parent_class_nocheck(p_class)); -} - -void EditorFeatureProfile::set_disable_class_property(const StringName &p_class, const StringName &p_property, bool p_disabled) { - if (p_disabled) { - if (!disabled_properties.has(p_class)) { - disabled_properties[p_class] = Set(); - } - - disabled_properties[p_class].insert(p_property); - } else { - ERR_FAIL_COND(!disabled_properties.has(p_class)); - disabled_properties[p_class].erase(p_property); - if (disabled_properties[p_class].empty()) { - disabled_properties.erase(p_class); - } - } -} -bool EditorFeatureProfile::is_class_property_disabled(const StringName &p_class, const StringName &p_property) const { - if (!disabled_properties.has(p_class)) { - return false; - } - - if (!disabled_properties[p_class].has(p_property)) { - return false; - } - - return true; -} - -bool EditorFeatureProfile::has_class_properties_disabled(const StringName &p_class) const { - return disabled_properties.has(p_class); -} - -void EditorFeatureProfile::set_item_collapsed(const StringName &p_class, bool p_collapsed) { - if (p_collapsed) { - collapsed_classes.insert(p_class); - } else { - collapsed_classes.erase(p_class); - } -} - -bool EditorFeatureProfile::is_item_collapsed(const StringName &p_class) const { - return collapsed_classes.has(p_class); -} - -void EditorFeatureProfile::set_disable_feature(Feature p_feature, bool p_disable) { - ERR_FAIL_INDEX(p_feature, FEATURE_MAX); - features_disabled[p_feature] = p_disable; -} -bool EditorFeatureProfile::is_feature_disabled(Feature p_feature) const { - ERR_FAIL_INDEX_V(p_feature, FEATURE_MAX, false); - return features_disabled[p_feature]; -} - -String EditorFeatureProfile::get_feature_name(Feature p_feature) { - ERR_FAIL_INDEX_V(p_feature, FEATURE_MAX, String()); - return feature_names[p_feature]; -} - -String EditorFeatureProfile::get_feature_description(Feature p_feature) { - ERR_FAIL_INDEX_V(p_feature, FEATURE_MAX, String()); - return feature_descriptions[p_feature]; -} - -Error EditorFeatureProfile::save_to_file(const String &p_path) { - Dictionary json; - json["type"] = "feature_profile"; - Array dis_classes; - for (Set::Element *E = disabled_classes.front(); E; E = E->next()) { - dis_classes.push_back(String(E->get())); - } - dis_classes.sort(); - json["disabled_classes"] = dis_classes; - - Array dis_editors; - for (Set::Element *E = disabled_editors.front(); E; E = E->next()) { - dis_editors.push_back(String(E->get())); - } - dis_editors.sort(); - json["disabled_editors"] = dis_editors; - - Array dis_props; - - for (Map>::Element *E = disabled_properties.front(); E; E = E->next()) { - for (Set::Element *F = E->get().front(); F; F = F->next()) { - dis_props.push_back(String(E->key()) + ":" + String(F->get())); - } - } - - json["disabled_properties"] = dis_props; - - Array dis_features; - for (int i = 0; i < FEATURE_MAX; i++) { - if (features_disabled[i]) { - dis_features.push_back(feature_identifiers[i]); - } - } - - json["disabled_features"] = dis_features; - - FileAccessRef f = FileAccess::open(p_path, FileAccess::WRITE); - ERR_FAIL_COND_V_MSG(!f, ERR_CANT_CREATE, "Cannot create file '" + p_path + "'."); - - String text = JSON::print(json, "\t"); - f->store_string(text); - f->close(); - return OK; -} - -Error EditorFeatureProfile::load_from_file(const String &p_path) { - Error err; - String text = FileAccess::get_file_as_string(p_path, &err); - if (err != OK) { - return err; - } - - String err_str; - int err_line; - Variant v; - err = JSON::parse(text, v, err_str, err_line); - if (err != OK) { - ERR_PRINT("Error parsing '" + p_path + "' on line " + itos(err_line) + ": " + err_str); - return ERR_PARSE_ERROR; - } - - Dictionary json = v; - - if (!json.has("type") || String(json["type"]) != "feature_profile") { - ERR_PRINT("Error parsing '" + p_path + "', it's not a feature profile."); - return ERR_PARSE_ERROR; - } - - disabled_classes.clear(); - - if (json.has("disabled_classes")) { - Array disabled_classes_arr = json["disabled_classes"]; - for (int i = 0; i < disabled_classes_arr.size(); i++) { - disabled_classes.insert(disabled_classes_arr[i]); - } - } - - disabled_editors.clear(); - - if (json.has("disabled_editors")) { - Array disabled_editors_arr = json["disabled_editors"]; - for (int i = 0; i < disabled_editors_arr.size(); i++) { - disabled_editors.insert(disabled_editors_arr[i]); - } - } - - disabled_properties.clear(); - - if (json.has("disabled_properties")) { - Array disabled_properties_arr = json["disabled_properties"]; - for (int i = 0; i < disabled_properties_arr.size(); i++) { - String s = disabled_properties_arr[i]; - set_disable_class_property(s.get_slice(":", 0), s.get_slice(":", 1), true); - } - } - - if (json.has("disabled_features")) { - Array disabled_features_arr = json["disabled_features"]; - for (int i = 0; i < FEATURE_MAX; i++) { - bool found = false; - String f = feature_identifiers[i]; - for (int j = 0; j < disabled_features_arr.size(); j++) { - String fd = disabled_features_arr[j]; - if (fd == f) { - found = true; - break; - } - } - - features_disabled[i] = found; - } - } - - return OK; -} - -void EditorFeatureProfile::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_disable_class", "class_name", "disable"), &EditorFeatureProfile::set_disable_class); - ClassDB::bind_method(D_METHOD("is_class_disabled", "class_name"), &EditorFeatureProfile::is_class_disabled); - - ClassDB::bind_method(D_METHOD("set_disable_class_editor", "class_name", "disable"), &EditorFeatureProfile::set_disable_class_editor); - ClassDB::bind_method(D_METHOD("is_class_editor_disabled", "class_name"), &EditorFeatureProfile::is_class_editor_disabled); - - ClassDB::bind_method(D_METHOD("set_disable_class_property", "class_name", "property", "disable"), &EditorFeatureProfile::set_disable_class_property); - ClassDB::bind_method(D_METHOD("is_class_property_disabled", "class_name", "property"), &EditorFeatureProfile::is_class_property_disabled); - - ClassDB::bind_method(D_METHOD("set_disable_feature", "feature", "disable"), &EditorFeatureProfile::set_disable_feature); - ClassDB::bind_method(D_METHOD("is_feature_disabled", "feature"), &EditorFeatureProfile::is_feature_disabled); - - ClassDB::bind_method(D_METHOD("get_feature_name", "feature"), &EditorFeatureProfile::_get_feature_name); - - ClassDB::bind_method(D_METHOD("save_to_file", "path"), &EditorFeatureProfile::save_to_file); - ClassDB::bind_method(D_METHOD("load_from_file", "path"), &EditorFeatureProfile::load_from_file); - - BIND_ENUM_CONSTANT(FEATURE_3D); - BIND_ENUM_CONSTANT(FEATURE_SCRIPT); - BIND_ENUM_CONSTANT(FEATURE_ASSET_LIB); - BIND_ENUM_CONSTANT(FEATURE_SCENE_TREE); - BIND_ENUM_CONSTANT(FEATURE_NODE_DOCK); - BIND_ENUM_CONSTANT(FEATURE_FILESYSTEM_DOCK); - BIND_ENUM_CONSTANT(FEATURE_IMPORT_DOCK); - BIND_ENUM_CONSTANT(FEATURE_MAX); -} - -EditorFeatureProfile::EditorFeatureProfile() { - for (int i = 0; i < FEATURE_MAX; i++) { - features_disabled[i] = false; - } -} - -////////////////////////// - -void EditorFeatureProfileManager::_notification(int p_what) { - if (p_what == NOTIFICATION_READY) { - current_profile = EDITOR_GET("_default_feature_profile"); - if (current_profile != String()) { - current.instance(); - Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile")); - if (err != OK) { - ERR_PRINT("Error loading default feature profile: " + current_profile); - current_profile = String(); - current.unref(); - } - } - _update_profile_list(current_profile); - } -} - -String EditorFeatureProfileManager::_get_selected_profile() { - int idx = profile_list->get_selected(); - if (idx < 0) { - return String(); - } - - return profile_list->get_item_metadata(idx); -} - -void EditorFeatureProfileManager::_update_profile_list(const String &p_select_profile) { - String selected_profile; - if (p_select_profile == String()) { //default, keep - if (profile_list->get_selected() >= 0) { - selected_profile = profile_list->get_item_metadata(profile_list->get_selected()); - if (!FileAccess::exists(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(selected_profile + ".profile"))) { - selected_profile = String(); //does not exist - } - } - } else { - selected_profile = p_select_profile; - } - - Vector profiles; - DirAccessRef d = DirAccess::open(EditorSettings::get_singleton()->get_feature_profiles_dir()); - ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + EditorSettings::get_singleton()->get_feature_profiles_dir() + "'."); - - d->list_dir_begin(); - while (true) { - String f = d->get_next(); - if (f == String()) { - break; - } - - if (!d->current_is_dir()) { - int last_pos = f.rfind(".profile"); - if (last_pos != -1) { - profiles.push_back(f.substr(0, last_pos)); - } - } - } - - profiles.sort(); - - profile_list->clear(); - - for (int i = 0; i < profiles.size(); i++) { - String name = profiles[i]; - - if (i == 0 && selected_profile == String()) { - selected_profile = name; - } - - if (name == current_profile) { - name += " " + TTR("(current)"); - } - profile_list->add_item(name); - int index = profile_list->get_item_count() - 1; - profile_list->set_item_metadata(index, profiles[i]); - if (profiles[i] == selected_profile) { - profile_list->select(index); - } - } - - class_list_vbc->set_visible(selected_profile != String()); - property_list_vbc->set_visible(selected_profile != String()); - no_profile_selected_help->set_visible(selected_profile == String()); - profile_actions[PROFILE_CLEAR]->set_disabled(current_profile == String()); - profile_actions[PROFILE_ERASE]->set_disabled(selected_profile == String()); - profile_actions[PROFILE_EXPORT]->set_disabled(selected_profile == String()); - profile_actions[PROFILE_SET]->set_disabled(selected_profile == String()); - - current_profile_name->set_text(current_profile != String() ? current_profile : TTR("(none)")); - - _update_selected_profile(); -} - -void EditorFeatureProfileManager::_profile_action(int p_action) { - switch (p_action) { - case PROFILE_CLEAR: { - EditorSettings::get_singleton()->set("_default_feature_profile", ""); - EditorSettings::get_singleton()->save(); - current_profile = ""; - current.unref(); - - _update_profile_list(); - _emit_current_profile_changed(); - } break; - case PROFILE_SET: { - String selected = _get_selected_profile(); - ERR_FAIL_COND(selected == String()); - if (selected == current_profile) { - return; // Nothing to do here. - } - EditorSettings::get_singleton()->set("_default_feature_profile", selected); - EditorSettings::get_singleton()->save(); - current_profile = selected; - current = edited; - - _update_profile_list(); - _emit_current_profile_changed(); - } break; - case PROFILE_IMPORT: { - import_profiles->popup_centered_ratio(); - } break; - case PROFILE_EXPORT: { - export_profile->popup_centered_ratio(); - export_profile->set_current_file(_get_selected_profile() + ".profile"); - } break; - case PROFILE_NEW: { - new_profile_dialog->popup_centered(Size2(240, 60) * EDSCALE); - new_profile_name->clear(); - new_profile_name->grab_focus(); - } break; - case PROFILE_ERASE: { - String selected = _get_selected_profile(); - ERR_FAIL_COND(selected == String()); - - erase_profile_dialog->set_text(vformat(TTR("Remove currently selected profile, '%s'? Cannot be undone."), selected)); - erase_profile_dialog->popup_centered(Size2(240, 60) * EDSCALE); - } break; - } -} - -void EditorFeatureProfileManager::_erase_selected_profile() { - String selected = _get_selected_profile(); - ERR_FAIL_COND(selected == String()); - DirAccessRef da = DirAccess::open(EditorSettings::get_singleton()->get_feature_profiles_dir()); - ERR_FAIL_COND_MSG(!da, "Cannot open directory '" + EditorSettings::get_singleton()->get_feature_profiles_dir() + "'."); - - da->remove(selected + ".profile"); - if (selected == current_profile) { - _profile_action(PROFILE_CLEAR); - } else { - _update_profile_list(); - } -} - -void EditorFeatureProfileManager::_create_new_profile() { - String name = new_profile_name->get_text().strip_edges(); - if (!name.is_valid_filename() || name.find(".") != -1) { - EditorNode::get_singleton()->show_warning(TTR("Profile must be a valid filename and must not contain '.'")); - return; - } - String file = EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(name + ".profile"); - if (FileAccess::exists(file)) { - EditorNode::get_singleton()->show_warning(TTR("Profile with this name already exists.")); - return; - } - - Ref new_profile; - new_profile.instance(); - new_profile->save_to_file(file); - - _update_profile_list(name); - // The newly created profile is the first one, make it the current profile automatically. - if (profile_list->get_item_count() == 1) { - _profile_action(PROFILE_SET); - } -} - -void EditorFeatureProfileManager::_profile_selected(int p_what) { - _update_selected_profile(); -} - -void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const String &p_class, const String &p_selected) { - TreeItem *class_item = class_list->create_item(p_parent); - class_item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - class_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_class, "Node")); - String text = p_class; - - bool disabled = edited->is_class_disabled(p_class); - bool disabled_editor = edited->is_class_editor_disabled(p_class); - bool disabled_properties = edited->has_class_properties_disabled(p_class); - if (disabled) { - class_item->set_custom_color(0, get_color("disabled_font_color", "Editor")); - } else if (disabled_editor && disabled_properties) { - text += " " + TTR("(Editor Disabled, Properties Disabled)"); - } else if (disabled_properties) { - text += " " + TTR("(Properties Disabled)"); - } else if (disabled_editor) { - text += " " + TTR("(Editor Disabled)"); - } - class_item->set_text(0, text); - class_item->set_editable(0, true); - class_item->set_selectable(0, true); - class_item->set_metadata(0, p_class); - - bool collapsed = edited->is_item_collapsed(p_class); - class_item->set_collapsed(collapsed); - - if (p_class == p_selected) { - class_item->select(0); - } - if (disabled) { - //class disabled, do nothing else (do not show further) - return; - } - - class_item->set_checked(0, true); // if its not disabled, its checked - - List child_classes; - ClassDB::get_direct_inheriters_from_class(p_class, &child_classes); - child_classes.sort_custom(); - - for (List::Element *E = child_classes.front(); E; E = E->next()) { - String name = E->get(); - if (name.begins_with("Editor") || ClassDB::get_api_type(name) != ClassDB::API_CORE) { - continue; - } - _fill_classes_from(class_item, name, p_selected); - } -} - -void EditorFeatureProfileManager::_class_list_item_selected() { - if (updating_features) { - return; - } - - property_list->clear(); - - TreeItem *item = class_list->get_selected(); - if (!item) { - return; - } - - Variant md = item->get_metadata(0); - if (md.get_type() == Variant::STRING) { - String class_name = md; - String class_description; - - DocData *dd = EditorHelp::get_doc_data(); - Map::Element *E = dd->class_list.find(class_name); - if (E) { - class_description = DTR(E->get().brief_description); - } - - description_bit->set_text(class_description); - } else if (md.get_type() == Variant::INT) { - int feature_id = md; - String feature_description = EditorFeatureProfile::get_feature_description(EditorFeatureProfile::Feature(feature_id)); - - description_bit->set_text(TTRGET(feature_description)); - return; - } else { - return; - } - - String class_name = md; - if (edited->is_class_disabled(class_name)) { - return; - } - - updating_features = true; - TreeItem *root = property_list->create_item(); - TreeItem *options = property_list->create_item(root); - options->set_text(0, TTR("Class Options:")); - - { - TreeItem *option = property_list->create_item(options); - option->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - option->set_editable(0, true); - option->set_selectable(0, true); - option->set_checked(0, !edited->is_class_editor_disabled(class_name)); - option->set_text(0, TTR("Enable Contextual Editor")); - option->set_metadata(0, CLASS_OPTION_DISABLE_EDITOR); - } - - List props; - ClassDB::get_property_list(class_name, &props, true); - - bool has_editor_props = false; - for (List::Element *E = props.front(); E; E = E->next()) { - if (E->get().usage & PROPERTY_USAGE_EDITOR) { - has_editor_props = true; - break; - } - } - - if (has_editor_props) { - TreeItem *properties = property_list->create_item(root); - properties->set_text(0, TTR("Class Properties:")); - - for (List::Element *E = props.front(); E; E = E->next()) { - String name = E->get().name; - if (!(E->get().usage & PROPERTY_USAGE_EDITOR)) { - continue; - } - TreeItem *property = property_list->create_item(properties); - property->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - property->set_editable(0, true); - property->set_selectable(0, true); - property->set_checked(0, !edited->is_class_property_disabled(class_name, name)); - property->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(name)); - property->set_tooltip(0, EditorPropertyNameProcessor::get_singleton()->make_tooltip_for_name(name)); - property->set_metadata(0, name); - String icon_type = Variant::get_type_name(E->get().type); - property->set_icon(0, EditorNode::get_singleton()->get_class_icon(icon_type)); - } - } - - updating_features = false; -} - -void EditorFeatureProfileManager::_class_list_item_edited() { - if (updating_features) { - return; - } - - TreeItem *item = class_list->get_edited(); - if (!item) { - return; - } - - bool checked = item->is_checked(0); - - Variant md = item->get_metadata(0); - if (md.get_type() == Variant::STRING) { - String class_selected = md; - edited->set_disable_class(class_selected, !checked); - _save_and_update(); - _update_selected_profile(); - } else if (md.get_type() == Variant::INT) { - int feature_selected = md; - edited->set_disable_feature(EditorFeatureProfile::Feature(feature_selected), !checked); - _save_and_update(); - } -} - -void EditorFeatureProfileManager::_class_list_item_collapsed(Object *p_item) { - if (updating_features) { - return; - } - - TreeItem *item = Object::cast_to(p_item); - if (!item) { - return; - } - - Variant md = item->get_metadata(0); - if (md.get_type() != Variant::STRING) { - return; - } - - String class_name = md; - bool collapsed = item->is_collapsed(); - edited->set_item_collapsed(class_name, collapsed); -} - -void EditorFeatureProfileManager::_property_item_edited() { - if (updating_features) { - return; - } - - TreeItem *class_item = class_list->get_selected(); - if (!class_item) { - return; - } - - Variant md = class_item->get_metadata(0); - if (md.get_type() != Variant::STRING) { - return; - } - - String class_name = md; - - TreeItem *item = property_list->get_edited(); - if (!item) { - return; - } - bool checked = item->is_checked(0); - - md = item->get_metadata(0); - if (md.get_type() == Variant::STRING) { - String property_selected = md; - edited->set_disable_class_property(class_name, property_selected, !checked); - _save_and_update(); - _update_selected_profile(); - } else if (md.get_type() == Variant::INT) { - int feature_selected = md; - switch (feature_selected) { - case CLASS_OPTION_DISABLE_EDITOR: { - edited->set_disable_class_editor(class_name, !checked); - _save_and_update(); - _update_selected_profile(); - } break; - } - } -} - -void EditorFeatureProfileManager::_update_selected_profile() { - String class_selected; - int feature_selected = -1; - - if (class_list->get_selected()) { - Variant md = class_list->get_selected()->get_metadata(0); - if (md.get_type() == Variant::STRING) { - class_selected = md; - } else if (md.get_type() == Variant::INT) { - feature_selected = md; - } - } - - class_list->clear(); - - String profile = _get_selected_profile(); - if (profile == String()) { //nothing selected, nothing edited - property_list->clear(); - edited.unref(); - return; - } - - if (profile == current_profile) { - edited = current; //reuse current profile (which is what editor uses) - ERR_FAIL_COND(current.is_null()); //nothing selected, current should never be null - } else { - //reload edited, if different from current - edited.instance(); - Error err = edited->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(profile + ".profile")); - ERR_FAIL_COND_MSG(err != OK, "Error when loading EditorSettings from file '" + EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(profile + ".profile") + "'."); - } - - updating_features = true; - - TreeItem *root = class_list->create_item(); - - TreeItem *features = class_list->create_item(root); - TreeItem *last_feature; - features->set_text(0, TTR("Main Features:")); - for (int i = 0; i < EditorFeatureProfile::FEATURE_MAX; i++) { - TreeItem *feature; - if (i == EditorFeatureProfile::FEATURE_IMPORT_DOCK) { - feature = class_list->create_item(last_feature); - } else { - feature = class_list->create_item(features); - last_feature = feature; - } - feature->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - feature->set_text(0, TTRGET(EditorFeatureProfile::get_feature_name(EditorFeatureProfile::Feature(i)))); - feature->set_selectable(0, true); - feature->set_editable(0, true); - feature->set_metadata(0, i); - if (!edited->is_feature_disabled(EditorFeatureProfile::Feature(i))) { - feature->set_checked(0, true); - } - - if (i == feature_selected) { - feature->select(0); - } - } - - TreeItem *classes = class_list->create_item(root); - classes->set_text(0, TTR("Nodes and Classes:")); - - _fill_classes_from(classes, "Node", class_selected); - _fill_classes_from(classes, "Resource", class_selected); - - updating_features = false; - - _class_list_item_selected(); -} - -void EditorFeatureProfileManager::_import_profiles(const Vector &p_paths) { - //test it first - for (int i = 0; i < p_paths.size(); i++) { - Ref profile; - profile.instance(); - Error err = profile->load_from_file(p_paths[i]); - String basefile = p_paths[i].get_file(); - if (err != OK) { - EditorNode::get_singleton()->show_warning(vformat(TTR("File '%s' format is invalid, import aborted."), basefile)); - return; - } - - String dst_file = EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(basefile); - - if (FileAccess::exists(dst_file)) { - EditorNode::get_singleton()->show_warning(vformat(TTR("Profile '%s' already exists. Remove it first before importing, import aborted."), basefile.get_basename())); - return; - } - } - - //do it second - for (int i = 0; i < p_paths.size(); i++) { - Ref profile; - profile.instance(); - Error err = profile->load_from_file(p_paths[i]); - ERR_CONTINUE(err != OK); - String basefile = p_paths[i].get_file(); - String dst_file = EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(basefile); - profile->save_to_file(dst_file); - } - - _update_profile_list(); - // The newly imported profile is the first one, make it the current profile automatically. - if (profile_list->get_item_count() == 1) { - _profile_action(PROFILE_SET); - } -} - -void EditorFeatureProfileManager::_export_profile(const String &p_path) { - ERR_FAIL_COND(edited.is_null()); - Error err = edited->save_to_file(p_path); - if (err != OK) { - EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving profile to path: '%s'."), p_path)); - } -} - -void EditorFeatureProfileManager::_save_and_update() { - String edited_path = _get_selected_profile(); - ERR_FAIL_COND(edited_path == String()); - ERR_FAIL_COND(edited.is_null()); - - edited->save_to_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(edited_path + ".profile")); - - if (edited == current) { - update_timer->start(); - } -} - -void EditorFeatureProfileManager::_emit_current_profile_changed() { - emit_signal("current_feature_profile_changed"); -} - -void EditorFeatureProfileManager::notify_changed() { - _emit_current_profile_changed(); -} - -Ref EditorFeatureProfileManager::get_current_profile() { - return current; -} - -EditorFeatureProfileManager *EditorFeatureProfileManager::singleton = nullptr; - -void EditorFeatureProfileManager::_bind_methods() { - ClassDB::bind_method("_update_selected_profile", &EditorFeatureProfileManager::_update_selected_profile); - ClassDB::bind_method("_profile_action", &EditorFeatureProfileManager::_profile_action); - ClassDB::bind_method("_create_new_profile", &EditorFeatureProfileManager::_create_new_profile); - ClassDB::bind_method("_profile_selected", &EditorFeatureProfileManager::_profile_selected); - ClassDB::bind_method("_erase_selected_profile", &EditorFeatureProfileManager::_erase_selected_profile); - ClassDB::bind_method("_import_profiles", &EditorFeatureProfileManager::_import_profiles); - ClassDB::bind_method("_export_profile", &EditorFeatureProfileManager::_export_profile); - ClassDB::bind_method("_class_list_item_selected", &EditorFeatureProfileManager::_class_list_item_selected); - ClassDB::bind_method("_class_list_item_edited", &EditorFeatureProfileManager::_class_list_item_edited); - ClassDB::bind_method("_class_list_item_collapsed", &EditorFeatureProfileManager::_class_list_item_collapsed); - ClassDB::bind_method("_property_item_edited", &EditorFeatureProfileManager::_property_item_edited); - ClassDB::bind_method("_emit_current_profile_changed", &EditorFeatureProfileManager::_emit_current_profile_changed); - - ADD_SIGNAL(MethodInfo("current_feature_profile_changed")); -} - -EditorFeatureProfileManager::EditorFeatureProfileManager() { - VBoxContainer *main_vbc = memnew(VBoxContainer); - add_child(main_vbc); - - HBoxContainer *name_hbc = memnew(HBoxContainer); - current_profile_name = memnew(LineEdit); - name_hbc->add_child(current_profile_name); - current_profile_name->set_text(TTR("(none)")); - current_profile_name->set_editable(false); - current_profile_name->set_h_size_flags(SIZE_EXPAND_FILL); - profile_actions[PROFILE_CLEAR] = memnew(Button(TTR("Reset to Default"))); - name_hbc->add_child(profile_actions[PROFILE_CLEAR]); - profile_actions[PROFILE_CLEAR]->set_disabled(true); - profile_actions[PROFILE_CLEAR]->connect("pressed", this, "_profile_action", varray(PROFILE_CLEAR)); - - main_vbc->add_margin_child(TTR("Current Profile:"), name_hbc); - - main_vbc->add_child(memnew(HSeparator)); - - HBoxContainer *profiles_hbc = memnew(HBoxContainer); - profile_list = memnew(OptionButton); - profile_list->set_h_size_flags(SIZE_EXPAND_FILL); - profiles_hbc->add_child(profile_list); - profile_list->connect("item_selected", this, "_profile_selected"); - - profile_actions[PROFILE_NEW] = memnew(Button(TTR("Create Profile"))); - profiles_hbc->add_child(profile_actions[PROFILE_NEW]); - profile_actions[PROFILE_NEW]->connect("pressed", this, "_profile_action", varray(PROFILE_NEW)); - - profile_actions[PROFILE_ERASE] = memnew(Button(TTR("Remove Profile"))); - profiles_hbc->add_child(profile_actions[PROFILE_ERASE]); - profile_actions[PROFILE_ERASE]->set_disabled(true); - profile_actions[PROFILE_ERASE]->connect("pressed", this, "_profile_action", varray(PROFILE_ERASE)); - - main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc); - - HBoxContainer *current_profile_hbc = memnew(HBoxContainer); - - profile_actions[PROFILE_SET] = memnew(Button(TTR("Make Current"))); - current_profile_hbc->add_child(profile_actions[PROFILE_SET]); - profile_actions[PROFILE_SET]->set_disabled(true); - profile_actions[PROFILE_SET]->connect("pressed", this, "_profile_action", varray(PROFILE_SET)); - - current_profile_hbc->add_child(memnew(VSeparator)); - - profile_actions[PROFILE_IMPORT] = memnew(Button(TTR("Import"))); - current_profile_hbc->add_child(profile_actions[PROFILE_IMPORT]); - profile_actions[PROFILE_IMPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_IMPORT)); - - profile_actions[PROFILE_EXPORT] = memnew(Button(TTR("Export"))); - current_profile_hbc->add_child(profile_actions[PROFILE_EXPORT]); - profile_actions[PROFILE_EXPORT]->set_disabled(true); - profile_actions[PROFILE_EXPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_EXPORT)); - - main_vbc->add_child(current_profile_hbc); - - h_split = memnew(HSplitContainer); - h_split->set_v_size_flags(SIZE_EXPAND_FILL); - main_vbc->add_child(h_split); - - class_list_vbc = memnew(VBoxContainer); - h_split->add_child(class_list_vbc); - class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); - - class_list = memnew(Tree); - class_list_vbc->add_margin_child(TTR("Configure Selected Profile:"), class_list, true); - class_list->set_hide_root(true); - class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - class_list->connect("cell_selected", this, "_class_list_item_selected"); - class_list->connect("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED); - class_list->connect("item_collapsed", this, "_class_list_item_collapsed"); - - // It will be displayed once the user creates or chooses a profile. - class_list_vbc->hide(); - - property_list_vbc = memnew(VBoxContainer); - h_split->add_child(property_list_vbc); - property_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); - - description_bit = memnew(EditorHelpBit); - property_list_vbc->add_margin_child(TTR("Description:"), description_bit, false); - description_bit->set_custom_minimum_size(Size2(0, 80) * EDSCALE); - - property_list = memnew(Tree); - property_list_vbc->add_margin_child(TTR("Extra Options:"), property_list, true); - property_list->set_hide_root(true); - property_list->set_hide_folding(true); - property_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - property_list->connect("item_edited", this, "_property_item_edited", varray(), CONNECT_DEFERRED); - - // It will be displayed once the user creates or chooses a profile. - property_list_vbc->hide(); - - no_profile_selected_help = memnew(Label(TTR("Create or import a profile to edit available classes and properties."))); - // Add some spacing above the help label. - Ref sb = memnew(StyleBoxEmpty); - sb->set_default_margin(MARGIN_TOP, 20 * EDSCALE); - no_profile_selected_help->add_style_override("normal", sb); - no_profile_selected_help->set_align(Label::ALIGN_CENTER); - no_profile_selected_help->set_v_size_flags(SIZE_EXPAND_FILL); - h_split->add_child(no_profile_selected_help); - - new_profile_dialog = memnew(ConfirmationDialog); - new_profile_dialog->set_title(TTR("Create Profile")); - VBoxContainer *new_profile_vb = memnew(VBoxContainer); - new_profile_dialog->add_child(new_profile_vb); - Label *new_profile_label = memnew(Label); - new_profile_label->set_text(TTR("New profile name:")); - new_profile_vb->add_child(new_profile_label); - new_profile_name = memnew(LineEdit); - new_profile_vb->add_child(new_profile_name); - new_profile_name->set_custom_minimum_size(Size2(300 * EDSCALE, 1)); - add_child(new_profile_dialog); - new_profile_dialog->connect("confirmed", this, "_create_new_profile"); - new_profile_dialog->register_text_enter(new_profile_name); - new_profile_dialog->get_ok()->set_text(TTR("Create")); - - erase_profile_dialog = memnew(ConfirmationDialog); - add_child(erase_profile_dialog); - erase_profile_dialog->set_title(TTR("Remove Profile")); - erase_profile_dialog->connect("confirmed", this, "_erase_selected_profile"); - - import_profiles = memnew(EditorFileDialog); - add_child(import_profiles); - import_profiles->set_mode(EditorFileDialog::MODE_OPEN_FILES); - import_profiles->add_filter("*.profile; " + TTR("Godot Feature Profile")); - import_profiles->connect("files_selected", this, "_import_profiles"); - import_profiles->set_title(TTR("Import Profile(s)")); - import_profiles->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - - export_profile = memnew(EditorFileDialog); - add_child(export_profile); - export_profile->set_mode(EditorFileDialog::MODE_SAVE_FILE); - export_profile->add_filter("*.profile; " + TTR("Godot Feature Profile")); - export_profile->connect("file_selected", this, "_export_profile"); - export_profile->set_title(TTR("Export Profile")); - export_profile->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - - set_title(TTR("Manage Editor Feature Profiles")); - EDITOR_DEF("_default_feature_profile", ""); - - update_timer = memnew(Timer); - update_timer->set_wait_time(1); //wait a second before updating editor - add_child(update_timer); - update_timer->connect("timeout", this, "_emit_current_profile_changed"); - update_timer->set_one_shot(true); - - updating_features = false; - - singleton = this; -} diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h deleted file mode 100644 index 23035f278..000000000 --- a/editor/editor_feature_profile.h +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************/ -/* editor_feature_profile.h */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ - -#ifndef EDITOR_FEATURE_PROFILE_H -#define EDITOR_FEATURE_PROFILE_H - -#include "core/os/file_access.h" -#include "core/reference.h" -#include "editor/editor_file_dialog.h" -#include "editor_help.h" -#include "scene/gui/dialogs.h" -#include "scene/gui/option_button.h" -#include "scene/gui/separator.h" -#include "scene/gui/split_container.h" -#include "scene/gui/tree.h" - -class EditorFeatureProfile : public Reference { - GDCLASS(EditorFeatureProfile, Reference); - -public: - enum Feature { - FEATURE_3D, - FEATURE_SCRIPT, - FEATURE_ASSET_LIB, - FEATURE_SCENE_TREE, - FEATURE_NODE_DOCK, - FEATURE_FILESYSTEM_DOCK, - FEATURE_IMPORT_DOCK, - FEATURE_MAX - }; - -private: - Set disabled_classes; - Set disabled_editors; - Map> disabled_properties; - - Set collapsed_classes; - - bool features_disabled[FEATURE_MAX]; - static const char *feature_names[FEATURE_MAX]; - static const char *feature_descriptions[FEATURE_MAX]; - static const char *feature_identifiers[FEATURE_MAX]; - - String _get_feature_name(Feature p_feature) { return get_feature_name(p_feature); } - -protected: - static void _bind_methods(); - -public: - void set_disable_class(const StringName &p_class, bool p_disabled); - bool is_class_disabled(const StringName &p_class) const; - - void set_disable_class_editor(const StringName &p_class, bool p_disabled); - bool is_class_editor_disabled(const StringName &p_class) const; - - void set_disable_class_property(const StringName &p_class, const StringName &p_property, bool p_disabled); - bool is_class_property_disabled(const StringName &p_class, const StringName &p_property) const; - bool has_class_properties_disabled(const StringName &p_class) const; - - void set_item_collapsed(const StringName &p_class, bool p_collapsed); - bool is_item_collapsed(const StringName &p_class) const; - - void set_disable_feature(Feature p_feature, bool p_disable); - bool is_feature_disabled(Feature p_feature) const; - - Error save_to_file(const String &p_path); - Error load_from_file(const String &p_path); - - static String get_feature_name(Feature p_feature); - static String get_feature_description(Feature p_feature); - - EditorFeatureProfile(); -}; - -VARIANT_ENUM_CAST(EditorFeatureProfile::Feature) - -class EditorFeatureProfileManager : public AcceptDialog { - GDCLASS(EditorFeatureProfileManager, AcceptDialog); - - enum Action { - PROFILE_CLEAR, - PROFILE_SET, - PROFILE_IMPORT, - PROFILE_EXPORT, - PROFILE_NEW, - PROFILE_ERASE, - PROFILE_MAX - }; - - enum ClassOptions { - CLASS_OPTION_DISABLE_EDITOR - }; - - ConfirmationDialog *erase_profile_dialog; - ConfirmationDialog *new_profile_dialog; - LineEdit *new_profile_name; - - LineEdit *current_profile_name; - OptionButton *profile_list; - Button *profile_actions[PROFILE_MAX]; - - HSplitContainer *h_split; - - VBoxContainer *class_list_vbc; - Tree *class_list; - VBoxContainer *property_list_vbc; - Tree *property_list; - EditorHelpBit *description_bit; - Label *no_profile_selected_help; - - EditorFileDialog *import_profiles; - EditorFileDialog *export_profile; - - void _profile_action(int p_action); - void _profile_selected(int p_what); - - String current_profile; - void _update_profile_list(const String &p_select_profile = String()); - void _update_selected_profile(); - void _fill_classes_from(TreeItem *p_parent, const String &p_class, const String &p_selected); - - Ref current; - Ref edited; - - void _erase_selected_profile(); - void _create_new_profile(); - String _get_selected_profile(); - - void _import_profiles(const Vector &p_paths); - void _export_profile(const String &p_path); - - bool updating_features; - - void _class_list_item_selected(); - void _class_list_item_edited(); - void _class_list_item_collapsed(Object *p_item); - void _property_item_edited(); - void _save_and_update(); - - Timer *update_timer; - void _emit_current_profile_changed(); - - static EditorFeatureProfileManager *singleton; - -protected: - static void _bind_methods(); - void _notification(int p_what); - -public: - Ref get_current_profile(); - void notify_changed(); - - static EditorFeatureProfileManager *get_singleton() { return singleton; } - EditorFeatureProfileManager(); -}; - -#endif // EDITOR_FEATURE_PROFILE_H diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index c4249c9e5..bcc5b4178 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -31,7 +31,6 @@ #include "editor_help_search.h" #include "core/os/keyboard.h" -#include "editor_feature_profile.h" #include "editor_node.h" #include "editor_scale.h" @@ -248,27 +247,6 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(results_tree, true); } -bool EditorHelpSearch::Runner::_is_class_disabled_by_feature_profile(const StringName &p_class) { - Ref profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); - if (profile.is_null()) { - return false; - } - - StringName class_name = p_class; - while (class_name != StringName()) { - if (!ClassDB::class_exists(class_name)) { - return false; - } - - if (profile->is_class_disabled(class_name)) { - return true; - } - class_name = ClassDB::get_parent_class(class_name); - } - - return false; -} - bool EditorHelpSearch::Runner::_slice() { bool phase_done = false; switch (phase) { @@ -317,56 +295,55 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() { bool EditorHelpSearch::Runner::_phase_match_classes() { DocData::ClassDoc &class_doc = iterator_doc->value(); - if (!_is_class_disabled_by_feature_profile(class_doc.name)) { - matches[class_doc.name] = ClassMatch(); - ClassMatch &match = matches[class_doc.name]; - match.doc = &class_doc; + matches[class_doc.name] = ClassMatch(); + ClassMatch &match = matches[class_doc.name]; - // Match class name. - if (search_flags & SEARCH_CLASSES) { - match.name = term == "" || _match_string(term, class_doc.name); + match.doc = &class_doc; + + // Match class name. + if (search_flags & SEARCH_CLASSES) { + match.name = term == "" || _match_string(term, class_doc.name); + } + + // Match members if the term is long enough. + if (term.length() > 1) { + if (search_flags & SEARCH_METHODS) { + for (int i = 0; i < class_doc.methods.size(); i++) { + String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.right(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { + match.methods.push_back(const_cast(&class_doc.methods[i])); + } + } } - - // Match members if the term is long enough. - if (term.length() > 1) { - if (search_flags & SEARCH_METHODS) { - for (int i = 0; i < class_doc.methods.size(); i++) { - String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); - if (method_name.find(term) > -1 || - (term.begins_with(".") && method_name.begins_with(term.right(1))) || - (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || - (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { - match.methods.push_back(const_cast(&class_doc.methods[i])); - } + if (search_flags & SEARCH_SIGNALS) { + for (int i = 0; i < class_doc.signals.size(); i++) { + if (_match_string(term, class_doc.signals[i].name)) { + match.signals.push_back(const_cast(&class_doc.signals[i])); } } - if (search_flags & SEARCH_SIGNALS) { - for (int i = 0; i < class_doc.signals.size(); i++) { - if (_match_string(term, class_doc.signals[i].name)) { - match.signals.push_back(const_cast(&class_doc.signals[i])); - } + } + if (search_flags & SEARCH_CONSTANTS) { + for (int i = 0; i < class_doc.constants.size(); i++) { + if (_match_string(term, class_doc.constants[i].name)) { + match.constants.push_back(const_cast(&class_doc.constants[i])); } } - if (search_flags & SEARCH_CONSTANTS) { - for (int i = 0; i < class_doc.constants.size(); i++) { - if (_match_string(term, class_doc.constants[i].name)) { - match.constants.push_back(const_cast(&class_doc.constants[i])); - } + } + if (search_flags & SEARCH_PROPERTIES) { + for (int i = 0; i < class_doc.properties.size(); i++) { + if (_match_string(term, class_doc.properties[i].name) || _match_string(term, class_doc.properties[i].getter) || _match_string(term, class_doc.properties[i].setter)) { + match.properties.push_back(const_cast(&class_doc.properties[i])); } } - if (search_flags & SEARCH_PROPERTIES) { - for (int i = 0; i < class_doc.properties.size(); i++) { - if (_match_string(term, class_doc.properties[i].name) || _match_string(term, class_doc.properties[i].getter) || _match_string(term, class_doc.properties[i].setter)) { - match.properties.push_back(const_cast(&class_doc.properties[i])); - } - } - } - if (search_flags & SEARCH_THEME_ITEMS) { - for (int i = 0; i < class_doc.theme_properties.size(); i++) { - if (_match_string(term, class_doc.theme_properties[i].name)) { - match.theme_properties.push_back(const_cast(&class_doc.theme_properties[i])); - } + } + if (search_flags & SEARCH_THEME_ITEMS) { + for (int i = 0; i < class_doc.theme_properties.size(); i++) { + if (_match_string(term, class_doc.theme_properties[i].name)) { + match.theme_properties.push_back(const_cast(&class_doc.theme_properties[i])); } } } diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index b69394a53..4f55c7894 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -126,8 +126,6 @@ class EditorHelpSearch::Runner : public Reference { TreeItem *matched_item; float match_highest_score = 0; - bool _is_class_disabled_by_feature_profile(const StringName &p_class); - bool _slice(); bool _phase_match_classes_init(); bool _phase_match_classes(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 21b20e67e..5f2fa43c8 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -34,7 +34,6 @@ #include "core/os/input.h" #include "core/os/keyboard.h" #include "dictionary_property_edit.h" -#include "editor_feature_profile.h" #include "editor_node.h" #include "editor_property_name_processor.h" #include "editor_scale.h" @@ -1352,28 +1351,6 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Refadded_editors.clear(); } -bool EditorInspector::_is_property_disabled_by_feature_profile(const StringName &p_property) { - Ref profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); - if (profile.is_null()) { - return false; - } - - StringName class_name = object->get_class(); - - while (class_name != StringName()) { - if (profile->is_class_property_disabled(class_name, p_property)) { - return true; - } - if (profile->is_class_disabled(class_name)) { - //won't see properties of a disabled class - return true; - } - class_name = ClassDB::get_parent_class(class_name); - } - - return false; -} - void EditorInspector::update_tree() { //to update properly if all is refreshed StringName current_selected = property_selected; @@ -1517,7 +1494,7 @@ void EditorInspector::update_tree() { continue; - } else if (!(p.usage & PROPERTY_USAGE_EDITOR) || _is_property_disabled_by_feature_profile(p.name)) { + } else if (!(p.usage & PROPERTY_USAGE_EDITOR)) { continue; } @@ -2196,7 +2173,6 @@ void EditorInspector::_node_removed(Node *p_node) { void EditorInspector::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); _update_inspector_bg(); } @@ -2293,10 +2269,6 @@ String EditorInspector::get_object_class() const { return object_class; } -void EditorInspector::_feature_profile_changed() { - update_tree(); -} - void EditorInspector::_bind_methods() { ClassDB::bind_method("_property_changed", &EditorInspector::_property_changed, DEFVAL(""), DEFVAL(false)); ClassDB::bind_method("_multiple_properties_changed", &EditorInspector::_multiple_properties_changed); @@ -2313,7 +2285,6 @@ void EditorInspector::_bind_methods() { ClassDB::bind_method("_resource_selected", &EditorInspector::_resource_selected); ClassDB::bind_method("_object_id_selected", &EditorInspector::_object_id_selected); ClassDB::bind_method("_vscroll_changed", &EditorInspector::_vscroll_changed); - ClassDB::bind_method("_feature_profile_changed", &EditorInspector::_feature_profile_changed); ClassDB::bind_method("refresh", &EditorInspector::refresh); diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 82982ddfd..1eb804e89 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -339,10 +339,6 @@ class EditorInspector : public ScrollContainer { void _vscroll_changed(double); - void _feature_profile_changed(); - - bool _is_property_disabled_by_feature_profile(const StringName &p_property); - void _update_inspector_bg(); protected: diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4022fc011..adb2887df 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -72,7 +72,6 @@ #include "editor/editor_about.h" #include "editor/editor_audio_buses.h" #include "editor/editor_export.h" -#include "editor/editor_feature_profile.h" #include "editor/editor_file_system.h" #include "editor/editor_help.h" #include "editor/editor_inspector.h" @@ -493,8 +492,6 @@ void EditorNode::_notification(int p_what) { VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true); VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true); - feature_profile_manager->notify_changed(); - if (!main_editor_buttons[EDITOR_3D]->is_visible()) { //may be hidden due to feature profile _editor_select(EDITOR_2D); } else { @@ -1350,10 +1347,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { // The 3D editor may be disabled as a feature, but scenes can still be opened. // This check prevents the preview from regenerating in case those scenes are then saved. // The preview will be generated if no feature profile is set (as the 3D editor is enabled by default). - Ref profile = feature_profile_manager->get_current_profile(); - if (!profile.is_valid() || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)) { - img = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data(); - } + img = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data(); } if (img.is_valid() && img->get_width() > 0 && img->get_height() > 0) { @@ -1853,10 +1847,6 @@ void EditorNode::_dialog_action(String p_file) { } bool EditorNode::item_has_editor(Object *p_object) { - if (_is_class_editor_disabled_by_feature_profile(p_object->get_class())) { - return false; - } - return editor_data.get_subeditors(p_object).size() > 0; } @@ -1864,34 +1854,10 @@ void EditorNode::edit_item_resource(RES p_resource) { edit_item(p_resource.ptr()); } -bool EditorNode::_is_class_editor_disabled_by_feature_profile(const StringName &p_class) { - Ref profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); - if (profile.is_null()) { - return false; - } - - StringName class_name = p_class; - - while (class_name != StringName()) { - if (profile->is_class_disabled(class_name)) { - return true; - } - if (profile->is_class_editor_disabled(class_name)) { - return true; - } - class_name = ClassDB::get_parent_class(class_name); - } - - return false; -} - void EditorNode::edit_item(Object *p_object) { Vector sub_plugins; if (p_object) { - if (_is_class_editor_disabled_by_feature_profile(p_object->get_class())) { - return; - } sub_plugins = editor_data.get_subeditors(p_object); } @@ -2140,9 +2106,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { Vector sub_plugins; - if (!_is_class_editor_disabled_by_feature_profile(current_obj->get_class())) { - sub_plugins = editor_data.get_subeditors(current_obj); - } + sub_plugins = editor_data.get_subeditors(current_obj); if (!sub_plugins.empty()) { _display_top_editors(false); @@ -2822,9 +2786,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { custom_build_manage_templates->hide(); file_android_build_source->popup_centered_ratio(); } break; - case SETTINGS_MANAGE_FEATURE_PROFILES: { - feature_profile_manager->popup_centered_clamped(Size2(900, 800) * EDSCALE, 0.8); - } break; case SETTINGS_TOGGLE_FULLSCREEN: { OS::get_singleton()->set_window_fullscreen(!OS::get_singleton()->is_window_fullscreen()); @@ -3859,7 +3820,6 @@ void EditorNode::register_editor_types() { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); @@ -5551,39 +5511,6 @@ void EditorNode::_resource_loaded(RES p_resource, const String &p_path) { singleton->editor_folding.load_resource_folding(p_resource, p_path); } -void EditorNode::_feature_profile_changed() { - Ref profile = feature_profile_manager->get_current_profile(); - TabContainer *import_tabs = cast_to(import_dock->get_parent()); - TabContainer *node_tabs = cast_to(node_dock->get_parent()); - TabContainer *fs_tabs = cast_to(filesystem_dock->get_parent()); - if (profile.is_valid()) { - node_tabs->set_tab_hidden(node_dock->get_index(), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK)); - // The Import dock is useless without the FileSystem dock. Ensure the configuration is valid. - bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK); - fs_tabs->set_tab_hidden(filesystem_dock->get_index(), fs_dock_disabled); - import_tabs->set_tab_hidden(import_dock->get_index(), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK)); - - main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)); - main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT)); - - if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) || - (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed())) { - _editor_select(EDITOR_2D); - } - } else { - import_tabs->set_tab_hidden(import_dock->get_index(), false); - node_tabs->set_tab_hidden(node_dock->get_index(), false); - fs_tabs->set_tab_hidden(filesystem_dock->get_index(), false); - import_dock->set_visible(true); - node_dock->set_visible(true); - filesystem_dock->set_visible(true); - main_editor_buttons[EDITOR_3D]->set_visible(true); - main_editor_buttons[EDITOR_SCRIPT]->set_visible(true); - } - - _update_dock_slots_visibility(); -} - void EditorNode::_bind_methods() { GLOBAL_DEF("editor/scene/scene_naming", SCENE_NAME_CASING_AUTO); ProjectSettings::get_singleton()->set_custom_property_info("editor/scene/scene_naming", PropertyInfo(Variant::INT, "editor/scene/scene_naming", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case")); @@ -5676,7 +5603,6 @@ void EditorNode::_bind_methods() { ClassDB::bind_method(D_METHOD("_reload_modified_scenes"), &EditorNode::_reload_modified_scenes); ClassDB::bind_method(D_METHOD("_reload_project_settings"), &EditorNode::_reload_project_settings); ClassDB::bind_method(D_METHOD("_resave_scenes"), &EditorNode::_resave_scenes); - ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &EditorNode::_feature_profile_changed); ClassDB::bind_method("_screenshot", &EditorNode::_screenshot); ClassDB::bind_method("_request_screenshot", &EditorNode::_request_screenshot); @@ -6249,12 +6175,6 @@ EditorNode::EditorNode() { export_template_manager = memnew(ExportTemplateManager); gui_base->add_child(export_template_manager); - feature_profile_manager = memnew(EditorFeatureProfileManager); - gui_base->add_child(feature_profile_manager); - about = memnew(EditorAbout); - gui_base->add_child(about); - feature_profile_manager->connect("current_feature_profile_changed", this, "_feature_profile_changed"); - warning = memnew(AcceptDialog); warning->add_button(TTR("Copy Text"), true, "copy"); gui_base->add_child(warning); @@ -6464,7 +6384,6 @@ EditorNode::EditorNode() { } p->add_separator(); - p->add_item(TTR("Manage Editor Features..."), SETTINGS_MANAGE_FEATURE_PROFILES); p->add_item(TTR("Manage Export Templates..."), SETTINGS_MANAGE_EXPORT_TEMPLATES); // Help Menu diff --git a/editor/editor_node.h b/editor/editor_node.h index 66abb1858..99287bfe7 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -54,7 +54,6 @@ class DependencyEditor; class DependencyErrorDialog; class EditorAbout; class EditorExport; -class EditorFeatureProfileManager; class EditorFileServer; class EditorInspector; class EditorLayoutsDialog; @@ -188,7 +187,6 @@ private: SETTINGS_EDITOR_DATA_FOLDER, SETTINGS_EDITOR_CONFIG_FOLDER, SETTINGS_MANAGE_EXPORT_TEMPLATES, - SETTINGS_MANAGE_FEATURE_PROFILES, SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE, SETTINGS_PICK_MAIN_SCENE, SETTINGS_TOGGLE_FULLSCREEN, @@ -337,7 +335,6 @@ private: PopupMenu *vcs_actions_menu; EditorFileDialog *file; ExportTemplateManager *export_template_manager; - EditorFeatureProfileManager *feature_profile_manager; EditorFileDialog *file_templates; EditorFileDialog *file_export_lib; EditorFileDialog *file_script; @@ -663,8 +660,6 @@ private: void _reload_project_settings(); void _resave_scenes(String p_str); - void _feature_profile_changed(); - bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class); Ref _load_custom_class_icon(const String &p_path) const; static String _to_absolute_plugin_path(const String &p_path); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 725d7e371..2d266c3e4 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -37,7 +37,6 @@ #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/project_settings.h" -#include "editor_feature_profile.h" #include "editor_node.h" #include "editor_resource_preview.h" #include "editor_scale.h" @@ -105,11 +104,6 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory for (int i = 0; i < p_dir->get_file_count(); i++) { String file_type = p_dir->get_file_type(i); - if (_is_file_type_disabled_by_feature_profile(file_type)) { - // If type is disabled, file won't be displayed. - continue; - } - String file_name = p_dir->get_file(i); if (searched_string.length() > 0) { if (file_name.to_lower().find(searched_string) < 0) { @@ -324,7 +318,6 @@ void FileSystemDock::_notification(int p_what) { return; } initialized = true; - EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed"); EditorResourcePreview::get_singleton()->connect("preview_invalidated", this, "_preview_invalidated"); @@ -578,24 +571,6 @@ void FileSystemDock::_set_file_display(bool p_active) { _update_file_list(true); } -bool FileSystemDock::_is_file_type_disabled_by_feature_profile(const StringName &p_class) { - Ref profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); - if (profile.is_null()) { - return false; - } - - StringName class_name = p_class; - - while (class_name != StringName()) { - if (profile->is_class_disabled(class_name)) { - return true; - } - class_name = ClassDB::get_parent_class(class_name); - } - - return false; -} - void FileSystemDock::_search(EditorFileSystemDirectory *p_path, List *matches, int p_max_items) { if (matches->size() > p_max_items) { return; @@ -615,11 +590,6 @@ void FileSystemDock::_search(EditorFileSystemDirectory *p_path, List * fi.path = p_path->get_file_path(i); fi.import_broken = !p_path->get_file_import_is_valid(i); - if (_is_file_type_disabled_by_feature_profile(fi.type)) { - // This type is disabled, will not appear here. - continue; - } - matches->push_back(fi); if (matches->size() > p_max_items) { return; @@ -2689,10 +2659,6 @@ void FileSystemDock::_update_import_dock() { import_dock_needs_update = false; } -void FileSystemDock::_feature_profile_changed() { - _update_display_mode(true); -} - void FileSystemDock::set_file_sort(FileSortOption p_file_sort) { for (int i = 0; i != FILE_SORT_MAX; i++) { tree_button_sort->get_popup()->set_item_checked(i, (i == (int)p_file_sort)); @@ -2779,8 +2745,6 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_file_multi_selected"), &FileSystemDock::_file_multi_selected); ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock); - ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed); - ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file"))); ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"))); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index ace548269..0366fa3fc 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -299,9 +299,6 @@ private: Vector _tree_get_selected(bool remove_self_inclusion = true); - bool _is_file_type_disabled_by_feature_profile(const StringName &p_class); - - void _feature_profile_changed(); Vector _remove_self_included_paths(Vector selected_strings); protected: diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2d8758e02..6d3541689 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -34,7 +34,6 @@ #include "core/os/input.h" #include "core/os/keyboard.h" #include "core/project_settings.h" -#include "editor/editor_feature_profile.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" @@ -1223,8 +1222,6 @@ void SceneTreeDock::_notification(int p_what) { } first_enter = false; - EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); - CanvasItemEditorPlugin *canvas_item_plugin = Object::cast_to(editor_data->get_editor("2D")); if (canvas_item_plugin) { canvas_item_plugin->get_canvas_item_editor()->connect("item_lock_status_changed", scene_tree, "_update_tree"); @@ -3077,31 +3074,6 @@ void SceneTreeDock::_favorite_root_selected(const String &p_class) { _tool_selected(TOOL_CREATE_FAVORITE, false); } -void SceneTreeDock::_feature_profile_changed() { - Ref profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); - - if (profile.is_valid()) { - profile_allow_editing = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCENE_TREE); - profile_allow_script_editing = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT); - bool profile_allow_3d = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D); - - button_3d->set_visible(profile_allow_3d); - button_add->set_visible(profile_allow_editing); - button_instance->set_visible(profile_allow_editing); - scene_tree->set_can_rename(profile_allow_editing); - - } else { - button_3d->set_visible(true); - button_add->set_visible(true); - button_instance->set_visible(true); - scene_tree->set_can_rename(true); - profile_allow_editing = true; - profile_allow_script_editing = true; - } - - _update_script_button(); -} - void SceneTreeDock::_clear_clipboard() { for (List::Element *E = node_clipboard.front(); E; E = E->next()) { memdelete(E->get()); @@ -3207,7 +3179,6 @@ void SceneTreeDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_script_button"), &SceneTreeDock::_update_script_button); ClassDB::bind_method(D_METHOD("_favorite_root_selected"), &SceneTreeDock::_favorite_root_selected); ClassDB::bind_method(D_METHOD("_update_create_root_dialog"), &SceneTreeDock::_update_create_root_dialog); - ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &SceneTreeDock::_feature_profile_changed); ClassDB::bind_method(D_METHOD("instance"), &SceneTreeDock::instance); ClassDB::bind_method(D_METHOD("get_tree_editor"), &SceneTreeDock::get_tree_editor); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index dc08f2d7b..6ca2dd33e 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -249,8 +249,6 @@ class SceneTreeDock : public VBoxContainer { void _update_create_root_dialog(); void _favorite_root_selected(const String &p_class); - void _feature_profile_changed(); - void _clear_clipboard(); void _create_remap_for_node(Node *p_node, Map &r_remap); void _create_remap_for_resource(RES p_resource, Map &r_remap); diff --git a/main/main.cpp b/main/main.cpp index 0c9bda4e8..f5bf83324 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -976,7 +976,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED if (editor) { packed_data->set_disabled(true); - globals->set_disable_feature_overrides(true); } #endif