From a031911c828da4f6f93950afa0688ac062bc96bd Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 23 Nov 2022 00:14:08 +0100 Subject: [PATCH] Use check_changed_settings_in_group() everywhere --- editor/animation_bezier_editor.cpp | 4 +- editor/animation_track_editor.cpp | 12 +++-- editor/code_editor.cpp | 14 +++++- editor/connections_dialog.cpp | 4 +- .../debug_adapter/debug_adapter_server.cpp | 5 ++- editor/debugger/editor_debugger_node.cpp | 3 +- editor/editor_help.cpp | 7 ++- editor/editor_help_search.cpp | 8 +++- editor/editor_inspector.cpp | 5 ++- editor/editor_node.cpp | 45 +++++++++++-------- editor/editor_settings_dialog.cpp | 5 ++- editor/filesystem_dock.cpp | 6 ++- editor/gui/editor_file_dialog.cpp | 3 ++ editor/gui/editor_scene_tabs.cpp | 6 ++- editor/import_dock.cpp | 5 ++- .../animation_blend_tree_editor_plugin.cpp | 4 +- .../animation_player_editor_plugin.cpp | 5 ++- .../plugins/asset_library_editor_plugin.cpp | 5 +++ editor/plugins/canvas_item_editor_plugin.cpp | 4 ++ .../collision_shape_2d_editor_plugin.cpp | 2 +- editor/plugins/curve_editor_plugin.cpp | 7 ++- editor/plugins/node_3d_editor_plugin.cpp | 12 +++-- editor/plugins/polygon_2d_editor_plugin.cpp | 7 ++- editor/plugins/script_editor_plugin.cpp | 5 +++ editor/plugins/text_shader_editor.cpp | 3 ++ .../plugins/texture_region_editor_plugin.cpp | 9 +++- editor/plugins/tiles/tile_atlas_view.cpp | 7 ++- .../plugins/tiles/tile_map_layer_editor.cpp | 4 +- .../plugins/visual_shader_editor_plugin.cpp | 14 +++--- editor/scene_tree_dock.cpp | 4 +- editor/themes/editor_theme_manager.cpp | 36 ++++++++++----- editor/themes/editor_theme_manager.h | 4 ++ .../gdscript_language_server.cpp | 4 ++ .../gridmap/editor/grid_map_editor_plugin.cpp | 3 ++ .../multiplayer/editor/replication_editor.cpp | 8 +++- scene/gui/line_edit.cpp | 3 ++ 36 files changed, 213 insertions(+), 69 deletions(-) diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index c0ee0f9f5d38..c900c80cf120 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -213,7 +213,9 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V void AnimationBezierTrackEdit::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + } } break; case NOTIFICATION_ENTER_TREE: { diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 23f2b7819976..bea1540b957a 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1395,7 +1395,6 @@ void AnimationTimelineEdit::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); add_track->set_icon(get_editor_theme_icon(SNAME("Add"))); loop->set_icon(get_editor_theme_icon(SNAME("Loop"))); time_icon->set_texture(get_editor_theme_icon(SNAME("Time"))); @@ -1413,7 +1412,9 @@ void AnimationTimelineEdit::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + } } break; case NOTIFICATION_RESIZED: { @@ -4741,8 +4742,11 @@ MenuButton *AnimationTrackEditor::get_edit_menu() { void AnimationTrackEditor::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); - } break; + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + break; + } + [[fallthrough]]; + } case NOTIFICATION_ENTER_TREE: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 76d0d4011020..e7d2f2bda752 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -38,6 +38,7 @@ #include "editor/editor_string_names.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/resources/font.h" void GotoLineDialog::popup_find_line(CodeEdit *p_edit) { @@ -92,8 +93,13 @@ GotoLineDialog::GotoLineDialog() { void FindReplaceBar::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_READY: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorThemeManager::is_generated_theme_outdated()) { + break; + } + [[fallthrough]]; + } + case NOTIFICATION_READY: { find_prev->set_icon(get_editor_theme_icon(SNAME("MoveUp"))); find_next->set_icon(get_editor_theme_icon(SNAME("MoveDown"))); hide_button->set_texture_normal(get_editor_theme_icon(SNAME("Close"))); @@ -1721,7 +1727,11 @@ void CodeTextEditor::_update_text_editor_theme() { } void CodeTextEditor::_on_settings_change() { - _apply_settings_change(); + if (EditorThemeManager::is_generated_theme_outdated() || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/completion")) { + _apply_settings_change(); + } } void CodeTextEditor::_apply_settings_change() { diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 41a3437f2054..9fef2006112f 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -1342,7 +1342,9 @@ void ConnectionsDock::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - update_tree(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editors")) { + update_tree(); + } } break; } } diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp index 9cecc4bb083e..a16c49429931 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp @@ -62,9 +62,12 @@ void DebugAdapterServer::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("network/debug_adapter")) { + break; + } protocol._request_timeout = EDITOR_GET("network/debug_adapter/request_timeout"); protocol._sync_breakpoints = EDITOR_GET("network/debug_adapter/sync_breakpoints"); - int port = (int)_EDITOR_GET("network/debug_adapter/remote_port"); + int port = _EDITOR_GET("network/debug_adapter/remote_port"); if (port != remote_port) { stop(); start(); diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 6471bd449ef0..14997c52bbf2 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -43,6 +43,7 @@ #include "editor/plugins/editor_debugger_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/gui/menu_button.h" #include "scene/gui/tab_container.h" #include "scene/resources/packed_scene.h" @@ -312,7 +313,7 @@ void EditorDebuggerNode::stop(bool p_force) { void EditorDebuggerNode::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (tabs->get_tab_count() > 1) { + if (tabs->get_tab_count() > 1 && EditorThemeManager::is_generated_theme_outdated()) { add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanelDebuggerOverride"), EditorStringName(EditorStyles))->get_margin(SIDE_LEFT)); add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanelDebuggerOverride"), EditorStringName(EditorStyles))->get_margin(SIDE_RIGHT)); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 56bada0c3265..cc63618f1ed1 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -2818,8 +2818,13 @@ void EditorHelp::_notification(int p_what) { _class_desc_resized(false); } break; - case NOTIFICATION_READY: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help")) { + break; + } + [[fallthrough]]; + } + case NOTIFICATION_READY: { _wait_for_thread(); _update_doc(); } break; diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 7ece5097311d..ae2bfcfd5ae6 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -36,6 +36,7 @@ #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" bool EditorHelpSearch::_all_terms_in_name(const Vector &p_terms, const String &p_name) const { for (int i = 0; i < p_terms.size(); i++) { @@ -214,7 +215,12 @@ void EditorHelpSearch::_notification(int p_what) { connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed)); } break; - case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorThemeManager::is_generated_theme_outdated()) { + break; + } + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { const int icon_width = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); results_tree->add_theme_constant_override("icon_max_width", icon_width); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 583a52ed52e3..12b643cb29c8 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -43,6 +43,7 @@ #include "editor/multi_node_edit.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/gui/spin_box.h" #include "scene/gui/texture_rect.h" #include "scene/property_utils.h" @@ -4045,7 +4046,9 @@ void EditorInspector::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - _update_inspector_bg(); + if (EditorThemeManager::is_generated_theme_outdated()) { + _update_inspector_bg(); + } bool needs_update = false; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c0d48609da3d..4f1e0ac912b8 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -761,36 +761,43 @@ void EditorNode::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - _update_vsync_mode(); - FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); - EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); - EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog")) { + FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); + } if (EditorThemeManager::is_generated_theme_outdated()) { _update_theme(); + _build_icon_type_cache(); + recent_scenes->reset_size(); } - scene_tabs->update_scene_tabs(); - recent_scenes->reset_size(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/scene_tabs")) { + scene_tabs->update_scene_tabs(); + } - _build_icon_type_cache(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) { + HashSet updated_textfile_extensions; + bool extensions_match = true; + const Vector textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); + for (const String &E : textfile_ext) { + updated_textfile_extensions.insert(E); + if (extensions_match && !textfile_extensions.has(E)) { + extensions_match = false; + } + } - HashSet updated_textfile_extensions; - bool extensions_match = true; - const Vector textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); - for (const String &E : textfile_ext) { - updated_textfile_extensions.insert(E); - if (extensions_match && !textfile_extensions.has(E)) { - extensions_match = false; + if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size()) { + textfile_extensions = updated_textfile_extensions; + EditorFileSystem::get_singleton()->scan(); } } - if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size()) { - textfile_extensions = updated_textfile_extensions; - EditorFileSystem::get_singleton()->scan(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor")) { + _update_update_spinner(); + _update_vsync_mode(); } - - _update_update_spinner(); } break; } } diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index e50b92366b66..13e3c41e3b0b 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -44,6 +44,7 @@ #include "editor/event_listener_line_edit.h" #include "editor/input_event_configuration_dialog.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/gui/margin_container.h" void EditorSettingsDialog::ok_pressed() { @@ -145,7 +146,9 @@ void EditorSettingsDialog::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - _update_icons(); + if (EditorThemeManager::is_generated_theme_outdated()) { + _update_icons(); + } bool update_shortcuts_tab = EditorSettings::get_singleton()->check_changed_settings_in_group("shortcuts") || diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index ac8346054251..76e06fcc35db 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -618,8 +618,10 @@ void FileSystemDock::_notification(int p_what) { _update_tree(get_uncollapsed_paths()); } - // Change full tree mode. - _update_display_mode(); + if (EditorThemeManager::is_generated_theme_outdated()) { + // Change full tree mode. + _update_display_mode(); + } } break; } } diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index c57c22404d6f..2dada2572805 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -135,6 +135,9 @@ void EditorFileDialog::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog")) { + break; + } bool is_showing_hidden = EDITOR_GET("filesystem/file_dialog/show_hidden_files"); if (show_hidden_files != is_showing_hidden) { set_show_hidden_files(is_showing_hidden); diff --git a/editor/gui/editor_scene_tabs.cpp b/editor/gui/editor_scene_tabs.cpp index 476b06f52bb4..fdc0c589cc6f 100644 --- a/editor/gui/editor_scene_tabs.cpp +++ b/editor/gui/editor_scene_tabs.cpp @@ -60,8 +60,10 @@ void EditorSceneTabs::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - scene_tabs->set_tab_close_display_policy((TabBar::CloseButtonDisplayPolicy)EDITOR_GET("interface/scene_tabs/display_close_button").operator int()); - scene_tabs->set_max_tab_width(int(EDITOR_GET("interface/scene_tabs/maximum_width")) * EDSCALE); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/scene_tabs")) { + scene_tabs->set_tab_close_display_policy((TabBar::CloseButtonDisplayPolicy)EDITOR_GET("interface/scene_tabs/display_close_button").operator int()); + scene_tabs->set_max_tab_width(int(EDITOR_GET("interface/scene_tabs/maximum_width")) * EDSCALE); + } } break; } } diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 0ceece263c2d..47572a991c5e 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -37,6 +37,7 @@ #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" class ImportDockParameters : public Object { GDCLASS(ImportDockParameters, Object); @@ -656,7 +657,9 @@ void ImportDock::_replace_resource_in_object(Object *p_object, const Refadd_theme_style_override("normal", get_theme_stylebox(SNAME("normal"), SNAME("LineEdit"))); + if (EditorThemeManager::is_generated_theme_outdated()) { + imported->add_theme_style_override("normal", get_theme_stylebox(SNAME("normal"), SNAME("LineEdit"))); + } } break; case NOTIFICATION_ENTER_TREE: { diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 78b464797525..22813124d0a5 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -940,7 +940,9 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - _update_editor_settings(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + _update_editor_settings(); + } } break; case NOTIFICATION_THEME_CHANGED: { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 4b2fa1876dc9..2a383816bad1 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -44,6 +44,7 @@ #include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning. #include "editor/scene_tree_dock.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/animation/animation_tree.h" #include "scene/gui/separator.h" #include "scene/main/window.h" @@ -129,7 +130,9 @@ void AnimationPlayerEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - add_theme_style_override("panel", EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("panel"), SNAME("Panel"))); + if (EditorThemeManager::is_generated_theme_outdated()) { + add_theme_style_override("panel", EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("panel"), SNAME("Panel"))); + } } break; case NOTIFICATION_TRANSLATION_CHANGED: diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index dca20e3dbcc7..459c5e8b31d8 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -679,6 +679,11 @@ void EditorAssetLibrary::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("asset_library") && + !EditorSettings::get_singleton()->check_changed_settings_in_group("netweork")) { + break; + } + _update_repository_options(); setup_http_request(request); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 132b85b090e8..34f04bae2dd0 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4010,6 +4010,10 @@ void CanvasItemEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorThemeManager::is_generated_theme_outdated() && + !EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + break; + } _update_editor_settings(); } break; diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index a2feea848895..31918586576f 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -537,7 +537,7 @@ void CollisionShape2DEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/polygon_editor/point_grab_radius")) { + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/polygon_editor")) { grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); } } break; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index ea32b659d734..ee9a2e99d978 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -118,8 +118,13 @@ void CurveEdit::_notification(int p_what) { queue_redraw(); } } break; - case NOTIFICATION_THEME_CHANGED: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen")) { + break; + } + [[fallthrough]]; + } + case NOTIFICATION_THEME_CHANGED: { float gizmo_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); point_radius = Math::round(BASE_POINT_RADIUS * get_theme_default_base_scale() * gizmo_scale); hover_radius = Math::round(BASE_HOVER_RADIUS * get_theme_default_base_scale() * gizmo_scale); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index f0cb2aa3a5c3..a007411d29ee 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2666,7 +2666,11 @@ void Node3DEditorPlugin::edited_scene_changed() { } void Node3DEditorViewport::_project_settings_changed() { - //update shadow atlas if changed + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("rendering")) { + return; + } + + // Update shadow atlas if changed. int shadowmap_size = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_size"); bool shadowmap_16_bits = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_16_bits"); int atlas_q0 = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_quadrant_0_subdiv"); @@ -7697,8 +7701,10 @@ void Node3DEditor::_notification(int p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { // Update grid color by rebuilding grid. - _finish_grid(); - _init_grid(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/3d")) { + _finish_grid(); + _init_grid(); + } } break; case NOTIFICATION_VISIBILITY_CHANGED: { diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index e56fc94a5530..707cf13cad16 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -75,8 +75,13 @@ int Polygon2DEditor::_get_polygon_count() const { void Polygon2DEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + break; + } + [[fallthrough]]; + } + case NOTIFICATION_ENTER_TREE: { uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index e6a1b76c78e0..d1d858b4dbdc 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2779,6 +2779,11 @@ void ScriptEditor::_save_layout() { } void ScriptEditor::_editor_settings_changed() { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor") && + !EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) { + return; + } + textfile_extensions.clear(); const Vector textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index ea200419f6db..17b48118acfd 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -740,6 +740,9 @@ void TextShaderEditor::_notification(int p_what) { } void TextShaderEditor::_editor_settings_changed() { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor")) { + return; + } shader_editor->update_editor_settings(); shader_editor->get_text_editor()->add_theme_constant_override("line_spacing", EDITOR_GET("text_editor/appearance/whitespace/line_spacing")); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index a3d578b43740..6c7a3f776e82 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -804,14 +804,19 @@ void TextureRegionEditor::_update_autoslice() { void TextureRegionEditor::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + break; + } + [[fallthrough]]; + } + + case NOTIFICATION_READY: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; case NOTIFICATION_ENTER_TREE: { get_tree()->connect("node_removed", callable_mp(this, &TextureRegionEditor::_node_removed)); - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); - hb_grid->set_visible(snap_mode == SNAP_GRID); if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) { _update_autoslice(); diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 721186ef8233..8c2cb68413e9 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -575,8 +575,13 @@ void TileAtlasView::_update_theme_item_cache() { void TileAtlasView::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + break; + } + [[fallthrough]]; + } + case NOTIFICATION_ENTER_TREE: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); } break; diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index e2f6cb0f3894..d24e7faeaf20 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -3650,7 +3650,9 @@ void TileMapLayerEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - toggle_grid_button->set_pressed(EDITOR_GET("editors/tiles_editor/display_grid")); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/tiles_editor")) { + toggle_grid_button->set_pressed_no_signal(EDITOR_GET("editors/tiles_editor/display_grid")); + } } break; } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index c69e85454fc6..47501794738e 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4307,11 +4307,15 @@ void VisualShaderEditor::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); - graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning"))); - graph->set_minimap_opacity(EDITOR_GET("editors/visual_editors/minimap_opacity")); - graph->set_connection_lines_curvature(EDITOR_GET("editors/visual_editors/lines_curvature")); - _update_graph(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning"))); + } + if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/visual_editors")) { + graph->set_minimap_opacity(EDITOR_GET("editors/visual_editors/minimap_opacity")); + graph->set_connection_lines_curvature(EDITOR_GET("editors/visual_editors/lines_curvature")); + _update_graph(); + } } break; case NOTIFICATION_ENTER_TREE: { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 8a580b565f69..1887e090cccc 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1475,7 +1475,9 @@ void SceneTreeDock::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/scene_tree")) { + scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false); + } } break; case NOTIFICATION_THEME_CHANGED: { diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index 479a3ebc87cd..b8f89a2fdf2b 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -2293,6 +2293,10 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref &p_ /* clang-format on */ } +void EditorThemeManager::_reset_dirty_flag() { + outdated_cache_dirty = true; +} + // Public interface for theme generation. Ref EditorThemeManager::generate_theme(const Ref &p_old_theme) { @@ -2323,18 +2327,26 @@ bool EditorThemeManager::is_generated_theme_outdated() { // Note that the editor scale is purposefully omitted because it cannot be changed // without a restart, so there is no point regenerating the theme. - // TODO: We can use this information more intelligently to do partial theme updates and speed things up. - return EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/increase_scrollbar_touch_area") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles") || - EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || - EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || - EditorSettings::get_singleton()->check_changed_settings_in_group("docks/property_editor/subresource_hue_tint") || - EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size") || - EditorSettings::get_singleton()->check_changed_settings_in_group("run/output/font_size"); + if (outdated_cache_dirty) { + // TODO: We can use this information more intelligently to do partial theme updates and speed things up. + outdated_cache = EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/increase_scrollbar_touch_area") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || + EditorSettings::get_singleton()->check_changed_settings_in_group("docks/property_editor/subresource_hue_tint") || + EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size") || + EditorSettings::get_singleton()->check_changed_settings_in_group("run/output/font_size"); + + // The outdated flag is relevant at the moment of changing editor settings. + callable_mp_static(&EditorThemeManager::_reset_dirty_flag).call_deferred(); + outdated_cache_dirty = false; + } + + return outdated_cache; } bool EditorThemeManager::is_dark_theme() { diff --git a/editor/themes/editor_theme_manager.h b/editor/themes/editor_theme_manager.h index 0b30a9c853d3..de088a1011ad 100644 --- a/editor/themes/editor_theme_manager.h +++ b/editor/themes/editor_theme_manager.h @@ -36,6 +36,8 @@ class EditorThemeManager { static int benchmark_run; + static inline bool outdated_cache = false; + static inline bool outdated_cache_dirty = true; static String get_benchmark_key(); @@ -155,6 +157,8 @@ class EditorThemeManager { static void _generate_text_editor_defaults(ThemeConfiguration &p_config); static void _populate_text_editor_styles(const Ref &p_theme, ThemeConfiguration &p_config); + static void _reset_dirty_flag(); + public: static Ref generate_theme(const Ref &p_old_theme = nullptr); static bool is_generated_theme_outdated(); diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp index 053be7eec215..9ba41352f252 100644 --- a/modules/gdscript/language_server/gdscript_language_server.cpp +++ b/modules/gdscript/language_server/gdscript_language_server.cpp @@ -63,6 +63,10 @@ void GDScriptLanguageServer::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("network/language_server")) { + break; + } + String remote_host = String(_EDITOR_GET("network/language_server/remote_host")); int remote_port = (GDScriptLanguageServer::port_override > -1) ? GDScriptLanguageServer::port_override : (int)_EDITOR_GET("network/language_server/remote_port"); bool remote_use_thread = (bool)_EDITOR_GET("network/language_server/use_thread"); diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index c6b68e9d3471..d53bf7f7ecb0 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -1501,6 +1501,9 @@ GridMapEditor::~GridMapEditor() { void GridMapEditorPlugin::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/grid_map")) { + break; + } switch ((int)EDITOR_GET("editors/grid_map/editor_side")) { case 0: { // Left. Node3DEditor::get_singleton()->move_control_to_left_panel(grid_map_editor); diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index 2e3df732e289..51974e776702 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -40,6 +40,7 @@ #include "editor/inspector_dock.h" #include "editor/property_selector.h" #include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "scene/gui/dialogs.h" #include "scene/gui/separator.h" #include "scene/gui/tree.h" @@ -362,8 +363,13 @@ void ReplicationEditor::_drop_data_fw(const Point2 &p_point, const Variant &p_da void ReplicationEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + if (!EditorThemeManager::is_generated_theme_outdated()) { + break; + } + [[fallthrough]]; + } + case NOTIFICATION_ENTER_TREE: { add_theme_style_override("panel", EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("panel"), SNAME("Panel"))); add_pick_button->set_icon(get_theme_icon(SNAME("Add"), EditorStringName(EditorIcons))); pin->set_icon(get_theme_icon(SNAME("Pin"), EditorStringName(EditorIcons))); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 7aa4a136d99b..d707a98e1402 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2133,6 +2133,9 @@ PopupMenu *LineEdit::get_menu() const { void LineEdit::_editor_settings_changed() { #ifdef TOOLS_ENABLED + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/appearance/caret")) { + return; + } set_caret_blink_enabled(EDITOR_GET("text_editor/appearance/caret/caret_blink")); set_caret_blink_interval(EDITOR_GET("text_editor/appearance/caret/caret_blink_interval")); #endif