diff options
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/action_map_editor.cpp | 6 | ||||
| -rw-r--r-- | editor/editor_node.cpp | 23 | ||||
| -rw-r--r-- | editor/editor_node.h | 3 | ||||
| -rw-r--r-- | editor/editor_plugin.cpp | 9 | ||||
| -rw-r--r-- | editor/editor_plugin.h | 2 | ||||
| -rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
| -rw-r--r-- | editor/export/project_export.cpp | 1 | ||||
| -rw-r--r-- | editor/import_defaults_editor.cpp | 20 | ||||
| -rw-r--r-- | editor/import_defaults_editor.h | 1 | ||||
| -rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 4 | ||||
| -rw-r--r-- | editor/plugins/text_shader_editor.cpp | 2 | ||||
| -rw-r--r-- | editor/project_settings_editor.cpp | 2 |
12 files changed, 32 insertions, 43 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index 146b5a794c..36b19198e6 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -31,6 +31,7 @@ #include "editor/action_map_editor.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/event_listener_line_edit.h" #include "editor/input_event_configuration_dialog.h" #include "scene/gui/check_button.h" @@ -224,6 +225,7 @@ void ActionMapEditor::_tree_item_activated() { void ActionMapEditor::set_show_builtin_actions(bool p_show) { show_builtin_actions = p_show; show_builtin_actions_checkbutton->set_pressed(p_show); + EditorSettings::get_singleton()->set_project_metadata("project_settings", "show_builtin_actions", show_builtin_actions); // Prevent unnecessary updates of action list when cache is empty. if (!actions_cache.is_empty()) { @@ -568,11 +570,13 @@ ActionMapEditor::ActionMapEditor() { _add_edit_text_changed(add_edit->get_text()); show_builtin_actions_checkbutton = memnew(CheckButton); - show_builtin_actions_checkbutton->set_pressed(false); show_builtin_actions_checkbutton->set_text(TTR("Show Built-in Actions")); show_builtin_actions_checkbutton->connect("toggled", callable_mp(this, &ActionMapEditor::set_show_builtin_actions)); add_hbox->add_child(show_builtin_actions_checkbutton); + show_builtin_actions = EditorSettings::get_singleton()->get_project_metadata("project_settings", "show_builtin_actions", false); + show_builtin_actions_checkbutton->set_pressed(show_builtin_actions); + main_vbox->add_child(add_hbox); // Action Editor Tree diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c6f5a6082b..945372fbdf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -431,6 +431,8 @@ void EditorNode::shortcut_input(const Ref<InputEvent> &p_event) { } void EditorNode::_update_from_settings() { + _update_title(); + int current_filter = GLOBAL_GET("rendering/textures/canvas_textures/default_texture_filter"); if (current_filter != scene_root->get_default_canvas_item_texture_filter()) { Viewport::DefaultCanvasItemTextureFilter tf = (Viewport::DefaultCanvasItemTextureFilter)current_filter; @@ -509,6 +511,8 @@ void EditorNode::_update_from_settings() { tree->set_debug_collisions_color(GLOBAL_GET("debug/shapes/collision/shape_color")); tree->set_debug_collision_contact_color(GLOBAL_GET("debug/shapes/collision/contact_color")); + ResourceImporterTexture::get_singleton()->update_imports(); + #ifdef DEBUG_ENABLED NavigationServer3D::get_singleton()->set_debug_navigation_edge_connection_color(GLOBAL_GET("debug/shapes/navigation/edge_connection_color")); NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_color(GLOBAL_GET("debug/shapes/navigation/geometry_edge_color")); @@ -584,18 +588,6 @@ void EditorNode::_notification(int p_what) { ResourceImporterTexture::get_singleton()->update_imports(); - if (settings_changed) { - _update_title(); - } - - if (settings_changed) { - _update_from_settings(); - settings_changed = false; - emit_signal(SNAME("project_settings_changed")); - } - - ResourceImporterTexture::get_singleton()->update_imports(); - bottom_panel_updating = false; } break; @@ -1146,7 +1138,6 @@ void EditorNode::_reload_modified_scenes() { void EditorNode::_reload_project_settings() { ProjectSettings::get_singleton()->setup(ProjectSettings::get_singleton()->get_resource_path(), String(), true); - settings_changed = true; } void EditorNode::_vp_resized() { @@ -6731,7 +6722,6 @@ void EditorNode::_bind_methods() { ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "args"))); ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj"))); ADD_SIGNAL(MethodInfo("scene_saved", PropertyInfo(Variant::STRING, "path"))); - ADD_SIGNAL(MethodInfo("project_settings_changed")); ADD_SIGNAL(MethodInfo("scene_changed")); ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "path"))); } @@ -6817,10 +6807,6 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p return eta.exitcode; } -void EditorNode::notify_settings_changed() { - settings_changed = true; -} - EditorNode::EditorNode() { EditorPropertyNameProcessor *epnp = memnew(EditorPropertyNameProcessor); add_child(epnp); @@ -6868,6 +6854,7 @@ EditorNode::EditorNode() { EditorUndoRedoManager::get_singleton()->connect("version_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed)); EditorUndoRedoManager::get_singleton()->connect("history_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed)); + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &EditorNode::_update_from_settings)); TranslationServer::get_singleton()->set_enabled(false); // Load settings. diff --git a/editor/editor_node.h b/editor/editor_node.h index 86b4847e5b..a4dfacf60c 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -465,7 +465,6 @@ private: bool immediate_dialog_confirmed = false; bool opening_prev = false; bool restoring_scenes = false; - bool settings_changed = true; // Make it update settings on first frame. bool unsaved_cache = true; bool waiting_for_first_scan = true; @@ -926,8 +925,6 @@ public: void try_autosave(); void restart_editor(); - void notify_settings_changed(); - void dim_editor(bool p_dimming); bool is_editor_dimmed() const; diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 2d4c07b263..98e71203ff 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -527,19 +527,24 @@ void EditorPlugin::remove_resource_conversion_plugin(const Ref<EditorResourceCon EditorNode::get_singleton()->remove_resource_conversion_plugin(p_plugin); } +#ifndef DISABLE_DEPRECATED void EditorPlugin::_editor_project_settings_changed() { emit_signal(SNAME("project_settings_changed")); } +#endif + void EditorPlugin::_notification(int p_what) { +#ifndef DISABLE_DEPRECATED switch (p_what) { case NOTIFICATION_ENTER_TREE: { - EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed)); + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed)); } break; case NOTIFICATION_EXIT_TREE: { - EditorNode::get_singleton()->disconnect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed)); + ProjectSettings::get_singleton()->disconnect("settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed)); } break; } +#endif } void EditorPlugin::_bind_methods() { diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 7dcf62144d..62ed432ecc 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -63,7 +63,9 @@ class EditorPlugin : public Node { String last_main_screen_name; String plugin_version; +#ifndef DISABLE_DEPRECATED void _editor_project_settings_changed(); +#endif protected: void _notification(int p_what); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index ee020223e6..92789275a9 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1299,7 +1299,7 @@ EditorPropertyLayers::EditorPropertyLayers() { layers->set_hide_on_checkable_item_selection(false); layers->connect("id_pressed", callable_mp(this, &EditorPropertyLayers::_menu_pressed)); layers->connect("popup_hide", callable_mp((BaseButton *)button, &BaseButton::set_pressed).bind(false)); - EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPropertyLayers::_refresh_names)); + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &EditorPropertyLayers::_refresh_names)); } ///////////////////// INT ///////////////////////// diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 61f875713f..b0d7534c83 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -65,7 +65,6 @@ void ProjectExportTextureFormatError::_bind_methods() { void ProjectExportTextureFormatError::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { texture_format_error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); } break; diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp index 98a9bfe9dc..1cee083fba 100644 --- a/editor/import_defaults_editor.cpp +++ b/editor/import_defaults_editor.cpp @@ -109,8 +109,6 @@ void ImportDefaultsEditor::_save() { } else { ProjectSettings::get_singleton()->set("importer_defaults/" + settings->importer->get_importer_name(), Variant()); } - - emit_signal(SNAME("project_settings_changed")); } } @@ -169,15 +167,13 @@ void ImportDefaultsEditor::_importer_selected(int p_index) { void ImportDefaultsEditor::clear() { String last_selected; - if (importers->get_selected() > 0) { + + if (importers->get_selected() >= 0) { last_selected = importers->get_item_text(importers->get_selected()); } importers->clear(); - importers->add_item("<" + TTR("Select Importer") + ">"); - importers->set_item_disabled(0, true); - List<Ref<ResourceImporter>> importer_list; ResourceFormatImporter::get_singleton()->get_importers(&importer_list); Vector<String> names; @@ -187,19 +183,21 @@ void ImportDefaultsEditor::clear() { } names.sort(); + // `last_selected.is_empty()` means it's the first time being called. + if (last_selected.is_empty() && !names.is_empty()) { + last_selected = names[0]; + } + for (int i = 0; i < names.size(); i++) { importers->add_item(names[i]); if (names[i] == last_selected) { - importers->select(i + 1); + importers->select(i); + _update_importer(); } } } -void ImportDefaultsEditor::_bind_methods() { - ADD_SIGNAL(MethodInfo("project_settings_changed")); -} - ImportDefaultsEditor::ImportDefaultsEditor() { HBoxContainer *hb = memnew(HBoxContainer); hb->add_child(memnew(Label(TTR("Importer:")))); diff --git a/editor/import_defaults_editor.h b/editor/import_defaults_editor.h index 763cdf8bf1..ccc74f39a5 100644 --- a/editor/import_defaults_editor.h +++ b/editor/import_defaults_editor.h @@ -57,7 +57,6 @@ class ImportDefaultsEditor : public VBoxContainer { protected: void _notification(int p_what); - static void _bind_methods(); public: void clear(); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 65563bd1a3..d38890eb36 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2721,7 +2721,7 @@ void Node3DEditorViewport::_project_settings_changed() { void Node3DEditorViewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &Node3DEditorViewport::_project_settings_changed)); + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &Node3DEditorViewport::_project_settings_changed)); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -7602,7 +7602,7 @@ void Node3DEditor::_notification(int p_what) { sun_state->set_custom_minimum_size(sun_vb->get_combined_minimum_size()); environ_state->set_custom_minimum_size(environ_vb->get_combined_minimum_size()); - EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &Node3DEditor::update_all_gizmos).bind(Variant())); + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &Node3DEditor::update_all_gizmos).bind(Variant())); } break; case NOTIFICATION_ENTER_TREE: { diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index ed98c7f85c..932a255982 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -1076,7 +1076,7 @@ TextShaderEditor::TextShaderEditor() { shader_editor->connect("show_warnings_panel", callable_mp(this, &TextShaderEditor::_show_warnings_panel)); shader_editor->connect("script_changed", callable_mp(this, &TextShaderEditor::apply_shaders)); EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &TextShaderEditor::_editor_settings_changed)); - ProjectSettingsEditor::get_singleton()->connect("confirmed", callable_mp(this, &TextShaderEditor::_project_settings_changed)); + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &TextShaderEditor::_project_settings_changed)); shader_editor->get_text_editor()->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line")); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 17826c8310..e33f9f921d 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -70,7 +70,6 @@ void ProjectSettingsEditor::popup_project_settings(bool p_clear_filter) { } void ProjectSettingsEditor::queue_save() { - EditorNode::get_singleton()->notify_settings_changed(); timer->start(); } @@ -734,7 +733,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { import_defaults_editor = memnew(ImportDefaultsEditor); import_defaults_editor->set_name(TTR("Import Defaults")); tab_container->add_child(import_defaults_editor); - import_defaults_editor->connect("project_settings_changed", callable_mp(this, &ProjectSettingsEditor::queue_save)); MovieWriter::set_extensions_hint(); // ensure extensions are properly displayed. } |
