Merge pull request #69032 from KoBeWi/check_every_changed_setting_in_every_group_everywhere()

Use `check_changed_settings_in_group()` everywhere
This commit is contained in:
Rémi Verschelde 2024-02-20 19:34:30 +01:00
commit 6037500219
No known key found for this signature in database
GPG key ID: C3336907360768E1
36 changed files with 213 additions and 69 deletions

View file

@ -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: {

View file

@ -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")));

View file

@ -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() {

View file

@ -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;
}
}

View file

@ -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();

View file

@ -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));

View file

@ -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;

View file

@ -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<String> &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);

View file

@ -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;

View file

@ -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<String> updated_textfile_extensions;
bool extensions_match = true;
const Vector<String> 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<String> updated_textfile_extensions;
bool extensions_match = true;
const Vector<String> 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;
}
}

View file

@ -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") ||

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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 Ref<Resourc
void ImportDock::_notification(int p_what) {
switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
imported->add_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: {

View file

@ -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: {

View file

@ -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:

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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: {

View file

@ -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;

View file

@ -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<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false);
for (const String &E : textfile_ext) {

View file

@ -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"));

View file

@ -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();

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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: {

View file

@ -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: {

View file

@ -2293,6 +2293,10 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref<EditorTheme> &p_
/* clang-format on */
}
void EditorThemeManager::_reset_dirty_flag() {
outdated_cache_dirty = true;
}
// Public interface for theme generation.
Ref<EditorTheme> EditorThemeManager::generate_theme(const Ref<EditorTheme> &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() {

View file

@ -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<EditorTheme> &p_theme, ThemeConfiguration &p_config);
static void _reset_dirty_flag();
public:
static Ref<EditorTheme> generate_theme(const Ref<EditorTheme> &p_old_theme = nullptr);
static bool is_generated_theme_outdated();

View file

@ -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");

View file

@ -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);

View file

@ -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)));

View file

@ -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