From 215e036600809fd588ec67b8d39efe12ae1ff4c5 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 19 Oct 2023 18:05:19 +0200 Subject: [PATCH] Add bulk change guards to successive theme overrides in Editor and GUI --- editor/code_editor.cpp | 16 ++++--- editor/editor_about.cpp | 7 +++ editor/editor_audio_buses.cpp | 2 + editor/editor_help.cpp | 2 + editor/editor_inspector.cpp | 4 ++ editor/editor_log.cpp | 2 + editor/editor_properties.cpp | 4 +- editor/gui/editor_run_bar.cpp | 2 + editor/gui/editor_zoom_widget.cpp | 14 +++--- .../import/audio_stream_import_settings.cpp | 10 +++- .../import/dynamic_font_import_settings.cpp | 47 ++++++++++--------- editor/import/scene_import_settings.cpp | 2 + editor/plugins/node_3d_editor_plugin.cpp | 4 ++ editor/plugins/texture_3d_editor_plugin.cpp | 22 ++++----- editor/plugins/texture_3d_editor_plugin.h | 8 ++-- .../plugins/texture_layered_editor_plugin.cpp | 22 ++++----- .../plugins/texture_layered_editor_plugin.h | 8 ++-- editor/plugins/theme_editor_preview.cpp | 2 +- .../plugins/visual_shader_editor_plugin.cpp | 8 ++++ editor/project_manager.cpp | 3 ++ scene/gui/color_picker.cpp | 10 ++++ scene/gui/file_dialog.cpp | 10 ++++ scene/gui/popup_menu.cpp | 2 + scene/gui/tab_container.cpp | 4 ++ 24 files changed, 145 insertions(+), 70 deletions(-) diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 014fe8a5300..7e6a49d6c07 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1718,6 +1718,8 @@ void CodeTextEditor::_update_text_editor_theme() { int status_bar_font_size = get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)); error->add_theme_font_override("font", status_bar_font); error->add_theme_font_size_override("font_size", status_bar_font_size); + error->end_bulk_theme_override(); + int count = status_bar->get_child_count(); for (int i = 0; i < count; i++) { Control *n = Object::cast_to(status_bar->get_child(i)); @@ -1726,7 +1728,6 @@ void CodeTextEditor::_update_text_editor_theme() { n->add_theme_font_size_override("font_size", status_bar_font_size); } } - error->end_bulk_theme_override(); } void CodeTextEditor::_on_settings_change() { @@ -1834,25 +1835,28 @@ void CodeTextEditor::_error_pressed(const Ref &p_event) { void CodeTextEditor::_update_status_bar_theme() { error_button->set_icon(get_editor_theme_icon(SNAME("StatusError"))); + warning_button->set_icon(get_editor_theme_icon(SNAME("NodeWarning"))); + + error_button->begin_bulk_theme_override(); error_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor))); error_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts))); error_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts))); + error_button->end_bulk_theme_override(); - warning_button->set_icon(get_editor_theme_icon(SNAME("NodeWarning"))); + warning_button->begin_bulk_theme_override(); warning_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); warning_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts))); warning_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts))); + warning_button->end_bulk_theme_override(); + line_and_col_txt->begin_bulk_theme_override(); line_and_col_txt->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts))); line_and_col_txt->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts))); + line_and_col_txt->end_bulk_theme_override(); } void CodeTextEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - _update_status_bar_theme(); - } break; - case NOTIFICATION_THEME_CHANGED: { _update_status_bar_theme(); if (toggle_scripts_button->is_visible()) { diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 848510f9c39..0f47466d231 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -42,12 +42,19 @@ const String EditorAbout::META_TEXT_TO_COPY = "text_to_copy"; void EditorAbout::_theme_changed() { const Ref font = get_theme_font(SNAME("source"), EditorStringName(EditorFonts)); const int font_size = get_theme_font_size(SNAME("source_size"), EditorStringName(EditorFonts)); + + _tpl_text->begin_bulk_theme_override(); _tpl_text->add_theme_font_override("normal_font", font); _tpl_text->add_theme_font_size_override("normal_font_size", font_size); _tpl_text->add_theme_constant_override("line_separation", 4 * EDSCALE); + _tpl_text->end_bulk_theme_override(); + + _license_text->begin_bulk_theme_override(); _license_text->add_theme_font_override("normal_font", font); _license_text->add_theme_font_size_override("normal_font_size", font_size); _license_text->add_theme_constant_override("line_separation", 4 * EDSCALE); + _license_text->end_bulk_theme_override(); + _logo->set_texture(get_editor_theme_icon(SNAME("Logo"))); } diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 1e1352016f3..f244bc0da86 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -828,10 +828,12 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { Ref sbempty = memnew(StyleBoxEmpty); for (int i = 0; i < hbc->get_child_count(); i++) { Control *child = Object::cast_to(hbc->get_child(i)); + child->begin_bulk_theme_override(); child->add_theme_style_override("normal", sbempty); child->add_theme_style_override("hover", sbempty); child->add_theme_style_override("focus", sbempty); child->add_theme_style_override("pressed", sbempty); + child->end_bulk_theme_override(); } HSeparator *separator = memnew(HSeparator); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 6e3b5b7b9e1..d6eadf3ab4f 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -159,6 +159,7 @@ void EditorHelp::_update_theme_item_cache() { theme_cache.background_style = get_theme_stylebox(SNAME("background"), SNAME("EditorHelp")); + class_desc->begin_bulk_theme_override(); class_desc->add_theme_font_override("normal_font", theme_cache.doc_font); class_desc->add_theme_font_size_override("normal_font_size", theme_cache.doc_font_size); @@ -168,6 +169,7 @@ void EditorHelp::_update_theme_item_cache() { class_desc->add_theme_constant_override("table_v_separation", get_theme_constant(SNAME("table_v_separation"), SNAME("EditorHelp"))); class_desc->add_theme_constant_override("text_highlight_h_padding", get_theme_constant(SNAME("text_highlight_h_padding"), SNAME("EditorHelp"))); class_desc->add_theme_constant_override("text_highlight_v_padding", get_theme_constant(SNAME("text_highlight_v_padding"), SNAME("EditorHelp"))); + class_desc->end_bulk_theme_override(); } void EditorHelp::_search(bool p_search_previous) { diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index e1a7d8f1110..3fa90b3d819 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2104,10 +2104,12 @@ void EditorInspectorArray::_setup() { ae.margin->set_mouse_filter(MOUSE_FILTER_PASS); if (is_inside_tree()) { Size2 min_size = get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles))->get_minimum_size(); + ae.margin->begin_bulk_theme_override(); ae.margin->add_theme_constant_override("margin_left", min_size.x / 2); ae.margin->add_theme_constant_override("margin_top", min_size.y / 2); ae.margin->add_theme_constant_override("margin_right", min_size.x / 2); ae.margin->add_theme_constant_override("margin_bottom", min_size.y / 2); + ae.margin->end_bulk_theme_override(); } ae.panel->add_child(ae.margin); @@ -2252,10 +2254,12 @@ void EditorInspectorArray::_notification(int p_what) { ae.move_down->set_icon(get_editor_theme_icon(SNAME("MoveDown"))); } Size2 min_size = get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles))->get_minimum_size(); + ae.margin->begin_bulk_theme_override(); ae.margin->add_theme_constant_override("margin_left", min_size.x / 2); ae.margin->add_theme_constant_override("margin_top", min_size.y / 2); ae.margin->add_theme_constant_override("margin_right", min_size.x / 2); ae.margin->add_theme_constant_override("margin_bottom", min_size.y / 2); + ae.margin->end_bulk_theme_override(); if (ae.erase) { ae.erase->set_icon(get_editor_theme_icon(SNAME("Remove"))); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index ed548ba5f8a..c58a0a75726 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -97,10 +97,12 @@ void EditorLog::_update_theme() { log->add_theme_constant_override("text_highlight_v_padding", 0); const int font_size = get_theme_font_size(SNAME("output_source_size"), EditorStringName(EditorFonts)); + log->begin_bulk_theme_override(); log->add_theme_font_size_override("normal_font_size", font_size); log->add_theme_font_size_override("bold_font_size", font_size); log->add_theme_font_size_override("italics_font_size", font_size); log->add_theme_font_size_override("mono_font_size", font_size); + log->end_bulk_theme_override(); type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_editor_theme_icon(SNAME("Popup"))); type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_editor_theme_icon(SNAME("StatusError"))); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 0be23fa3cc4..7884005ab7a 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3268,6 +3268,7 @@ void EditorPropertyResource::_update_property_bg() { updating_theme = true; + begin_bulk_theme_override(); if (sub_inspector != nullptr) { int count_subinspectors = 0; Node *n = get_parent(); @@ -3283,7 +3284,6 @@ void EditorPropertyResource::_update_property_bg() { add_theme_color_override("property_color", get_theme_color(SNAME("sub_inspector_property_color"), EditorStringName(Editor))); add_theme_style_override("bg_selected", get_theme_stylebox("sub_inspector_property_bg" + itos(count_subinspectors), EditorStringName(Editor))); add_theme_style_override("bg", get_theme_stylebox("sub_inspector_property_bg" + itos(count_subinspectors), EditorStringName(Editor))); - add_theme_constant_override("v_separation", 0); } else { add_theme_color_override("property_color", get_theme_color(SNAME("property_color"), SNAME("EditorProperty"))); @@ -3291,6 +3291,7 @@ void EditorPropertyResource::_update_property_bg() { add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("EditorProperty"))); add_theme_constant_override("v_separation", get_theme_constant(SNAME("v_separation"), SNAME("EditorProperty"))); } + end_bulk_theme_override(); updating_theme = false; queue_redraw(); @@ -3483,7 +3484,6 @@ void EditorPropertyResource::fold_resource() { void EditorPropertyResource::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (!updating_theme) { _update_property_bg(); diff --git a/editor/gui/editor_run_bar.cpp b/editor/gui/editor_run_bar.cpp index 497c92d9517..54fb60d074f 100644 --- a/editor/gui/editor_run_bar.cpp +++ b/editor/gui/editor_run_bar.cpp @@ -65,9 +65,11 @@ void EditorRunBar::_notification(int p_what) { write_movie_button->set_icon(get_editor_theme_icon(SNAME("MainMovieWrite"))); // This button behaves differently, so color it as such. + write_movie_button->begin_bulk_theme_override(); write_movie_button->add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.7)); write_movie_button->add_theme_color_override("icon_pressed_color", Color(0, 0, 0, 0.84)); write_movie_button->add_theme_color_override("icon_hover_color", Color(1, 1, 1, 0.9)); + write_movie_button->end_bulk_theme_override(); } break; } } diff --git a/editor/gui/editor_zoom_widget.cpp b/editor/gui/editor_zoom_widget.cpp index 5c936a75f2a..7d522761f34 100644 --- a/editor/gui/editor_zoom_widget.cpp +++ b/editor/gui/editor_zoom_widget.cpp @@ -195,38 +195,40 @@ EditorZoomWidget::EditorZoomWidget() { // Zoom buttons zoom_minus = memnew(Button); zoom_minus->set_flat(true); - add_child(zoom_minus); - zoom_minus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_minus)); zoom_minus->set_shortcut(ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_minus", TTR("Zoom Out"), { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::MINUS), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_SUBTRACT) })); zoom_minus->set_shortcut_context(this); zoom_minus->set_focus_mode(FOCUS_NONE); + add_child(zoom_minus); + zoom_minus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_minus)); zoom_reset = memnew(Button); zoom_reset->set_flat(true); + Ref empty_stylebox = memnew(StyleBoxEmpty); zoom_reset->add_theme_style_override("normal", empty_stylebox); zoom_reset->add_theme_style_override("hover", empty_stylebox); zoom_reset->add_theme_style_override("focus", empty_stylebox); zoom_reset->add_theme_style_override("pressed", empty_stylebox); - add_child(zoom_reset); zoom_reset->add_theme_constant_override("outline_size", Math::ceil(2 * EDSCALE)); zoom_reset->add_theme_color_override("font_outline_color", Color(0, 0, 0)); zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1)); - zoom_reset->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_reset)); + zoom_reset->set_shortcut(ED_GET_SHORTCUT("canvas_item_editor/zoom_100_percent")); zoom_reset->set_shortcut_context(this); zoom_reset->set_focus_mode(FOCUS_NONE); zoom_reset->set_text_alignment(HORIZONTAL_ALIGNMENT_CENTER); // Prevent the button's size from changing when the text size changes zoom_reset->set_custom_minimum_size(Size2(56 * EDSCALE, 0)); + add_child(zoom_reset); + zoom_reset->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_reset)); zoom_plus = memnew(Button); zoom_plus->set_flat(true); - add_child(zoom_plus); - zoom_plus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_plus)); zoom_plus->set_shortcut(ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_plus", TTR("Zoom In"), { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::EQUAL), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_ADD) })); zoom_plus->set_shortcut_context(this); zoom_plus->set_focus_mode(FOCUS_NONE); + add_child(zoom_plus); + zoom_plus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_plus)); _update_zoom_label(); diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index c77143c8ac9..d86b0645491 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -44,16 +44,22 @@ void AudioStreamImportSettings::_notification(int p_what) { connect("confirmed", callable_mp(this, &AudioStreamImportSettings::_reimport)); } break; - case NOTIFICATION_THEME_CHANGED: - case NOTIFICATION_ENTER_TREE: { + case NOTIFICATION_THEME_CHANGED: { _play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay"))); _stop_button->set_icon(get_editor_theme_icon(SNAME("Stop"))); + _preview->set_color(get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor))); color_rect->set_color(get_theme_color(SNAME("dark_color_1"), EditorStringName(Editor))); + + _current_label->begin_bulk_theme_override(); _current_label->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts))); _current_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts))); + _current_label->end_bulk_theme_override(); + + _duration_label->begin_bulk_theme_override(); _duration_label->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts))); _duration_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts))); + _duration_label->end_bulk_theme_override(); zoom_in->set_icon(get_editor_theme_icon(SNAME("ZoomMore"))); zoom_out->set_icon(get_editor_theme_icon(SNAME("ZoomLess"))); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 8a385aaf822..9e584cd4178 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -1333,8 +1333,8 @@ DynamicFontImportSettings::DynamicFontImportSettings() { inspector_general = memnew(EditorInspector); inspector_general->set_v_size_flags(Control::SIZE_EXPAND_FILL); inspector_general->set_custom_minimum_size(Size2(300 * EDSCALE, 250 * EDSCALE)); - inspector_general->connect("property_edited", callable_mp(this, &DynamicFontImportSettings::_main_prop_changed)); page1_hb->add_child(inspector_general); + inspector_general->connect("property_edited", callable_mp(this, &DynamicFontImportSettings::_main_prop_changed)); // Page 2 layout: Configurations VBoxContainer *page2_vb = memnew(VBoxContainer); @@ -1359,18 +1359,17 @@ DynamicFontImportSettings::DynamicFontImportSettings() { page2_side_vb->add_child(page2_hb_vars); label_vars = memnew(Label); - page2_hb_vars->add_child(label_vars); label_vars->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); label_vars->set_h_size_flags(Control::SIZE_EXPAND_FILL); label_vars->set_text(TTR("Configuration:")); + page2_hb_vars->add_child(label_vars); add_var = memnew(Button); - page2_hb_vars->add_child(add_var); add_var->set_tooltip_text(TTR("Add configuration")); + page2_hb_vars->add_child(add_var); add_var->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_variation_add)); vars_list = memnew(Tree); - page2_side_vb->add_child(vars_list); vars_list->set_custom_minimum_size(Size2(300 * EDSCALE, 0)); vars_list->set_hide_root(true); vars_list->set_columns(2); @@ -1378,14 +1377,15 @@ DynamicFontImportSettings::DynamicFontImportSettings() { vars_list->set_column_custom_minimum_width(0, 80 * EDSCALE); vars_list->set_column_expand(1, false); vars_list->set_column_custom_minimum_width(1, 50 * EDSCALE); + vars_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + page2_side_vb->add_child(vars_list); vars_list->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_variation_selected)); vars_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_variation_remove)); - vars_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); inspector_vars = memnew(EditorInspector); inspector_vars->set_v_size_flags(Control::SIZE_EXPAND_FILL); - inspector_vars->connect("property_edited", callable_mp(this, &DynamicFontImportSettings::_variation_changed)); page2_side_vb->add_child(inspector_vars); + inspector_vars->connect("property_edited", callable_mp(this, &DynamicFontImportSettings::_variation_changed)); VBoxContainer *preload_pages_vb = memnew(VBoxContainer); page2_hb->add_child(preload_pages_vb); @@ -1397,17 +1397,17 @@ DynamicFontImportSettings::DynamicFontImportSettings() { preload_pages_vb->add_child(preload_pages); HBoxContainer *gl_hb = memnew(HBoxContainer); - preload_pages_vb->add_child(gl_hb); gl_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); + preload_pages_vb->add_child(gl_hb); label_glyphs = memnew(Label); - gl_hb->add_child(label_glyphs); label_glyphs->set_text(vformat(TTR("Preloaded glyphs: %d"), 0)); label_glyphs->set_custom_minimum_size(Size2(50 * EDSCALE, 0)); + gl_hb->add_child(label_glyphs); Button *btn_clear = memnew(Button); - gl_hb->add_child(btn_clear); btn_clear->set_text(TTR("Clear Glyph List")); + gl_hb->add_child(btn_clear); btn_clear->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_glyph_clear)); VBoxContainer *page2_0_vb = memnew(VBoxContainer); @@ -1421,22 +1421,23 @@ DynamicFontImportSettings::DynamicFontImportSettings() { page2_0_vb->add_child(page2_0_description); locale_tree = memnew(Tree); - page2_0_vb->add_child(locale_tree); locale_tree->set_columns(1); locale_tree->set_hide_root(true); locale_tree->set_column_expand(0, true); - locale_tree->connect("item_activated", callable_mp(this, &DynamicFontImportSettings::_locale_edited)); locale_tree->set_column_custom_minimum_width(0, 120 * EDSCALE); locale_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); + page2_0_vb->add_child(locale_tree); + locale_tree->connect("item_activated", callable_mp(this, &DynamicFontImportSettings::_locale_edited)); + locale_root = locale_tree->create_item(); HBoxContainer *locale_hb = memnew(HBoxContainer); - page2_0_vb->add_child(locale_hb); locale_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); + page2_0_vb->add_child(locale_hb); btn_fill_locales = memnew(Button); - locale_hb->add_child(btn_fill_locales); btn_fill_locales->set_text(TTR("Shape all Strings in the Translations and Add Glyphs")); + locale_hb->add_child(btn_fill_locales); btn_fill_locales->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_process_locales)); // Page 2.1 layout: Text to select glyphs @@ -1451,29 +1452,29 @@ DynamicFontImportSettings::DynamicFontImportSettings() { page2_1_vb->add_child(page2_1_description); HSplitContainer *page2_1_hb = memnew(HSplitContainer); - page2_1_vb->add_child(page2_1_hb); page2_1_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); page2_1_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL); + page2_1_vb->add_child(page2_1_hb); inspector_text = memnew(EditorInspector); inspector_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); inspector_text->set_custom_minimum_size(Size2(300 * EDSCALE, 250 * EDSCALE)); - inspector_text->connect("property_edited", callable_mp(this, &DynamicFontImportSettings::_change_text_opts)); page2_1_hb->add_child(inspector_text); + inspector_text->connect("property_edited", callable_mp(this, &DynamicFontImportSettings::_change_text_opts)); text_edit = memnew(TextEdit); - page2_1_hb->add_child(text_edit); text_edit->set_v_size_flags(Control::SIZE_EXPAND_FILL); text_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); + page2_1_hb->add_child(text_edit); HBoxContainer *text_hb = memnew(HBoxContainer); - page2_1_vb->add_child(text_hb); text_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); + page2_1_vb->add_child(text_hb); btn_fill = memnew(Button); - text_hb->add_child(btn_fill); btn_fill->set_text(TTR("Shape Text and Add Glyphs")); + text_hb->add_child(btn_fill); btn_fill->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_glyph_text_selected)); // Page 2.2 layout: Character map @@ -1493,14 +1494,12 @@ DynamicFontImportSettings::DynamicFontImportSettings() { page2_2_vb->add_child(glyphs_split); glyph_table = memnew(Tree); - glyphs_split->add_child(glyph_table); glyph_table->set_custom_minimum_size(Size2((30 * 16 + 100) * EDSCALE, 0)); glyph_table->set_columns(17); glyph_table->set_column_expand(0, false); glyph_table->set_hide_root(true); glyph_table->set_allow_reselect(true); glyph_table->set_select_mode(Tree::SELECT_SINGLE); - glyph_table->connect("item_activated", callable_mp(this, &DynamicFontImportSettings::_glyph_selected)); glyph_table->set_column_titles_visible(true); for (int i = 0; i < 16; i++) { glyph_table->set_column_title(i + 1, String::num_int64(i, 16)); @@ -1510,22 +1509,24 @@ DynamicFontImportSettings::DynamicFontImportSettings() { glyph_table->add_theme_constant_override("h_separation", 0); glyph_table->set_h_size_flags(Control::SIZE_EXPAND_FILL); glyph_table->set_v_size_flags(Control::SIZE_EXPAND_FILL); + glyphs_split->add_child(glyph_table); + glyph_table->connect("item_activated", callable_mp(this, &DynamicFontImportSettings::_glyph_selected)); glyph_tree = memnew(Tree); - glyphs_split->add_child(glyph_tree); glyph_tree->set_custom_minimum_size(Size2(300 * EDSCALE, 0)); glyph_tree->set_columns(2); glyph_tree->set_hide_root(true); glyph_tree->set_column_expand(0, false); glyph_tree->set_column_expand(1, true); glyph_tree->set_column_custom_minimum_width(0, 120 * EDSCALE); - glyph_tree->connect("item_activated", callable_mp(this, &DynamicFontImportSettings::_range_edited)); - glyph_tree->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_range_selected)); glyph_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); glyph_root = glyph_tree->create_item(); for (int i = 0; !unicode_ranges[i].name.is_empty(); i++) { _add_glyph_range_item(unicode_ranges[i].start, unicode_ranges[i].end, unicode_ranges[i].name); } + glyphs_split->add_child(glyph_tree); + glyph_tree->connect("item_activated", callable_mp(this, &DynamicFontImportSettings::_range_edited)); + glyph_tree->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_range_selected)); // Common diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index 87b855052b2..d902ad1acc3 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -1141,9 +1141,11 @@ void SceneImportSettings::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { + action_menu->begin_bulk_theme_override(); action_menu->add_theme_style_override("normal", get_theme_stylebox("normal", "Button")); action_menu->add_theme_style_override("hover", get_theme_stylebox("hover", "Button")); action_menu->add_theme_style_override("pressed", get_theme_stylebox("pressed", "Button")); + action_menu->end_bulk_theme_override(); if (animation_player != nullptr && animation_player->is_playing()) { animation_play_button->set_icon(get_editor_theme_icon(SNAME("Pause"))); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 15486bb190e..792d9985aac 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2985,17 +2985,21 @@ void Node3DEditorViewport::_notification(int p_what) { preview_camera->set_icon(get_editor_theme_icon(SNAME("Camera3D"))); Control *gui_base = EditorNode::get_singleton()->get_gui_base(); + view_menu->begin_bulk_theme_override(); view_menu->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override("pressed", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override("focus", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override("disabled", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + view_menu->end_bulk_theme_override(); + preview_camera->begin_bulk_theme_override(); preview_camera->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override("pressed", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override("focus", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override("disabled", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + preview_camera->end_bulk_theme_override(); frame_time_gradient->set_color(0, get_theme_color(SNAME("success_color"), EditorStringName(Editor))); frame_time_gradient->set_color(1, get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp index 1b5c2dcab1f..0cba4aa4288 100644 --- a/editor/plugins/texture_3d_editor_plugin.cpp +++ b/editor/plugins/texture_3d_editor_plugin.cpp @@ -143,25 +143,23 @@ void Texture3DEditor::edit(Ref p_texture) { Texture3DEditor::Texture3DEditor() { set_texture_repeat(TextureRepeat::TEXTURE_REPEAT_ENABLED); set_custom_minimum_size(Size2(1, 150)); + texture_rect = memnew(Control); - texture_rect->connect("draw", callable_mp(this, &Texture3DEditor::_texture_rect_draw)); texture_rect->set_mouse_filter(MOUSE_FILTER_IGNORE); add_child(texture_rect); + texture_rect->connect("draw", callable_mp(this, &Texture3DEditor::_texture_rect_draw)); layer = memnew(SpinBox); layer->set_step(1); layer->set_max(100); + layer->set_h_grow_direction(GROW_DIRECTION_BEGIN); + layer->set_modulate(Color(1, 1, 1, 0.8)); add_child(layer); layer->set_anchor(SIDE_RIGHT, 1); layer->set_anchor(SIDE_LEFT, 1); - layer->set_h_grow_direction(GROW_DIRECTION_BEGIN); - layer->set_modulate(Color(1, 1, 1, 0.8)); + layer->connect("value_changed", callable_mp(this, &Texture3DEditor::_layer_changed)); + info = memnew(Label); - add_child(info); - info->set_anchor(SIDE_RIGHT, 1); - info->set_anchor(SIDE_LEFT, 1); - info->set_anchor(SIDE_BOTTOM, 1); - info->set_anchor(SIDE_TOP, 1); info->set_h_grow_direction(GROW_DIRECTION_BEGIN); info->set_v_grow_direction(GROW_DIRECTION_BEGIN); info->add_theme_color_override("font_color", Color(1, 1, 1, 1)); @@ -169,9 +167,11 @@ Texture3DEditor::Texture3DEditor() { info->add_theme_constant_override("shadow_outline_size", 1); info->add_theme_constant_override("shadow_offset_x", 2); info->add_theme_constant_override("shadow_offset_y", 2); - - setting = false; - layer->connect("value_changed", callable_mp(this, &Texture3DEditor::_layer_changed)); + add_child(info); + info->set_anchor(SIDE_RIGHT, 1); + info->set_anchor(SIDE_LEFT, 1); + info->set_anchor(SIDE_BOTTOM, 1); + info->set_anchor(SIDE_TOP, 1); } Texture3DEditor::~Texture3DEditor() { diff --git a/editor/plugins/texture_3d_editor_plugin.h b/editor/plugins/texture_3d_editor_plugin.h index bec33052896..2509cf86ba5 100644 --- a/editor/plugins/texture_3d_editor_plugin.h +++ b/editor/plugins/texture_3d_editor_plugin.h @@ -49,21 +49,21 @@ class Texture3DEditor : public Control { Control *texture_rect = nullptr; - void _make_shaders(); + bool setting = false; + void _make_shaders(); void _update_material(); - bool setting; + void _layer_changed(double) { if (!setting) { _update_material(); } } + void _texture_changed(); void _texture_rect_update_area(); void _texture_rect_draw(); - void _texture_changed(); - protected: void _notification(int p_what); diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index 20e7b5d8c49..b74a7624448 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -219,25 +219,23 @@ void TextureLayeredEditor::edit(Ref p_texture) { TextureLayeredEditor::TextureLayeredEditor() { set_texture_repeat(TextureRepeat::TEXTURE_REPEAT_ENABLED); set_custom_minimum_size(Size2(1, 150)); + texture_rect = memnew(Control); - texture_rect->connect("draw", callable_mp(this, &TextureLayeredEditor::_texture_rect_draw)); texture_rect->set_mouse_filter(MOUSE_FILTER_IGNORE); add_child(texture_rect); + texture_rect->connect("draw", callable_mp(this, &TextureLayeredEditor::_texture_rect_draw)); layer = memnew(SpinBox); layer->set_step(1); layer->set_max(100); + layer->set_h_grow_direction(GROW_DIRECTION_BEGIN); + layer->set_modulate(Color(1, 1, 1, 0.8)); add_child(layer); layer->set_anchor(SIDE_RIGHT, 1); layer->set_anchor(SIDE_LEFT, 1); - layer->set_h_grow_direction(GROW_DIRECTION_BEGIN); - layer->set_modulate(Color(1, 1, 1, 0.8)); + layer->connect("value_changed", callable_mp(this, &TextureLayeredEditor::_layer_changed)); + info = memnew(Label); - add_child(info); - info->set_anchor(SIDE_RIGHT, 1); - info->set_anchor(SIDE_LEFT, 1); - info->set_anchor(SIDE_BOTTOM, 1); - info->set_anchor(SIDE_TOP, 1); info->set_h_grow_direction(GROW_DIRECTION_BEGIN); info->set_v_grow_direction(GROW_DIRECTION_BEGIN); info->add_theme_color_override("font_color", Color(1, 1, 1, 1)); @@ -245,9 +243,11 @@ TextureLayeredEditor::TextureLayeredEditor() { info->add_theme_constant_override("shadow_outline_size", 1); info->add_theme_constant_override("shadow_offset_x", 2); info->add_theme_constant_override("shadow_offset_y", 2); - - setting = false; - layer->connect("value_changed", callable_mp(this, &TextureLayeredEditor::_layer_changed)); + add_child(info); + info->set_anchor(SIDE_RIGHT, 1); + info->set_anchor(SIDE_LEFT, 1); + info->set_anchor(SIDE_BOTTOM, 1); + info->set_anchor(SIDE_TOP, 1); } TextureLayeredEditor::~TextureLayeredEditor() { diff --git a/editor/plugins/texture_layered_editor_plugin.h b/editor/plugins/texture_layered_editor_plugin.h index 39cbb32d160..ea807c00809 100644 --- a/editor/plugins/texture_layered_editor_plugin.h +++ b/editor/plugins/texture_layered_editor_plugin.h @@ -51,21 +51,21 @@ class TextureLayeredEditor : public Control { float y_rot = 0; Control *texture_rect = nullptr; - void _make_shaders(); + bool setting = false; + void _make_shaders(); void _update_material(); - bool setting; + void _layer_changed(double) { if (!setting) { _update_material(); } } + void _texture_changed(); void _texture_rect_update_area(); void _texture_rect_draw(); - void _texture_changed(); - protected: void _notification(int p_what); virtual void gui_input(const Ref &p_event) override; diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index c157277a353..5dcdd9059ef 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -266,11 +266,11 @@ ThemeEditorPreview::ThemeEditorPreview() { preview_root->add_child(preview_bg); preview_content = memnew(MarginContainer); - preview_root->add_child(preview_content); preview_content->add_theme_constant_override("margin_right", 4 * EDSCALE); preview_content->add_theme_constant_override("margin_top", 4 * EDSCALE); preview_content->add_theme_constant_override("margin_left", 4 * EDSCALE); preview_content->add_theme_constant_override("margin_bottom", 4 * EDSCALE); + preview_root->add_child(preview_content); preview_overlay = memnew(MarginContainer); preview_overlay->set_mouse_filter(MOUSE_FILTER_IGNORE); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index da3bbb84bfb..f18585e9df3 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1095,9 +1095,12 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool } } + expression_box->begin_bulk_theme_override(); expression_box->add_theme_font_override("font", editor->get_theme_font(SNAME("expression"), EditorStringName(EditorFonts))); expression_box->add_theme_font_size_override("font_size", editor->get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts))); expression_box->add_theme_color_override("font_color", text_color); + expression_box->end_bulk_theme_override(); + expression_syntax_highlighter->set_number_color(number_color); expression_syntax_highlighter->set_symbol_color(symbol_color); expression_syntax_highlighter->set_function_color(function_color); @@ -4197,9 +4200,12 @@ void VisualShaderEditor::_notification(int p_what) { } } + preview_text->begin_bulk_theme_override(); preview_text->add_theme_font_override("font", get_theme_font(SNAME("expression"), EditorStringName(EditorFonts))); preview_text->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts))); preview_text->add_theme_color_override("font_color", text_color); + preview_text->end_bulk_theme_override(); + syntax_highlighter->set_number_color(number_color); syntax_highlighter->set_symbol_color(symbol_color); syntax_highlighter->set_function_color(function_color); @@ -4213,9 +4219,11 @@ void VisualShaderEditor::_notification(int p_what) { preview_text->add_comment_delimiter("//", "", true); error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Panel"))); + error_label->begin_bulk_theme_override(); error_label->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts))); error_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts))); error_label->add_theme_color_override("font_color", error_color); + error_label->end_bulk_theme_override(); } tools->set_icon(get_editor_theme_icon(SNAME("Tools"))); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index de807c79e0a..40c482eb90b 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -993,9 +993,12 @@ void ProjectListItemControl::_notification(int p_what) { project_icon->set_texture(get_editor_theme_icon(SNAME("ProjectIconLoading"))); } + project_title->begin_bulk_theme_override(); project_title->add_theme_font_override("font", get_theme_font(SNAME("title"), EditorStringName(EditorFonts))); project_title->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("title_size"), EditorStringName(EditorFonts))); project_title->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Tree"))); + project_title->end_bulk_theme_override(); + project_path->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Tree"))); project_unsupported_features->set_texture(get_editor_theme_icon(SNAME("NodeWarning"))); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index c2512bed664..761298c51c7 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -77,9 +77,11 @@ void ColorPicker::_notification(int p_what) { alpha_label->add_theme_constant_override(SNAME("center_grabber"), theme_cache.center_slider_grabbers); for (int i = 0; i < MODE_BUTTON_COUNT; i++) { + mode_btns[i]->begin_bulk_theme_override(); mode_btns[i]->add_theme_style_override(SNAME("pressed"), theme_cache.mode_button_pressed); mode_btns[i]->add_theme_style_override(SNAME("normal"), theme_cache.mode_button_normal); mode_btns[i]->add_theme_style_override(SNAME("hover"), theme_cache.mode_button_hover); + mode_btns[i]->end_bulk_theme_override(); } shape_popup->set_item_icon(shape_popup->get_item_index(SHAPE_HSV_RECTANGLE), theme_cache.shape_rect); @@ -87,10 +89,12 @@ void ColorPicker::_notification(int p_what) { shape_popup->set_item_icon(shape_popup->get_item_index(SHAPE_VHS_CIRCLE), theme_cache.shape_circle); shape_popup->set_item_icon(shape_popup->get_item_index(SHAPE_OKHSL_CIRCLE), theme_cache.shape_circle); + internal_margin->begin_bulk_theme_override(); internal_margin->add_theme_constant_override(SNAME("margin_bottom"), theme_cache.content_margin); internal_margin->add_theme_constant_override(SNAME("margin_left"), theme_cache.content_margin); internal_margin->add_theme_constant_override(SNAME("margin_right"), theme_cache.content_margin); internal_margin->add_theme_constant_override(SNAME("margin_top"), theme_cache.content_margin); + internal_margin->end_bulk_theme_override(); _reset_sliders_theme(); @@ -521,20 +525,26 @@ void ColorPicker::_reset_sliders_theme() { Ref style_box_flat(memnew(StyleBoxFlat)); style_box_flat->set_content_margin(SIDE_TOP, 16 * theme_cache.base_scale); style_box_flat->set_bg_color(Color(0.2, 0.23, 0.31).lerp(Color(0, 0, 0, 1), 0.3).clamp()); + for (int i = 0; i < SLIDER_COUNT; i++) { + sliders[i]->begin_bulk_theme_override(); sliders[i]->add_theme_icon_override("grabber", theme_cache.bar_arrow); sliders[i]->add_theme_icon_override("grabber_highlight", theme_cache.bar_arrow); sliders[i]->add_theme_constant_override("grabber_offset", 8 * theme_cache.base_scale); if (!colorize_sliders) { sliders[i]->add_theme_style_override("slider", style_box_flat); } + sliders[i]->end_bulk_theme_override(); } + + alpha_slider->begin_bulk_theme_override(); alpha_slider->add_theme_icon_override("grabber", theme_cache.bar_arrow); alpha_slider->add_theme_icon_override("grabber_highlight", theme_cache.bar_arrow); alpha_slider->add_theme_constant_override("grabber_offset", 8 * theme_cache.base_scale); if (!colorize_sliders) { alpha_slider->add_theme_style_override("slider", style_box_flat); } + alpha_slider->end_bulk_theme_override(); } void ColorPicker::_html_submitted(const String &p_html) { diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 2d2e9644491..d721ee3ec3e 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -144,30 +144,40 @@ void FileDialog::_notification(int p_what) { refresh->set_icon(theme_cache.reload); show_hidden->set_icon(theme_cache.toggle_hidden); + dir_up->begin_bulk_theme_override(); dir_up->add_theme_color_override("icon_normal_color", theme_cache.icon_normal_color); dir_up->add_theme_color_override("icon_hover_color", theme_cache.icon_hover_color); dir_up->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color); dir_up->add_theme_color_override("icon_pressed_color", theme_cache.icon_pressed_color); + dir_up->end_bulk_theme_override(); + dir_prev->begin_bulk_theme_override(); dir_prev->add_theme_color_override("icon_color_normal", theme_cache.icon_normal_color); dir_prev->add_theme_color_override("icon_color_hover", theme_cache.icon_hover_color); dir_prev->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color); dir_prev->add_theme_color_override("icon_color_pressed", theme_cache.icon_pressed_color); + dir_prev->end_bulk_theme_override(); + dir_next->begin_bulk_theme_override(); dir_next->add_theme_color_override("icon_color_normal", theme_cache.icon_normal_color); dir_next->add_theme_color_override("icon_color_hover", theme_cache.icon_hover_color); dir_next->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color); dir_next->add_theme_color_override("icon_color_pressed", theme_cache.icon_pressed_color); + dir_next->end_bulk_theme_override(); + refresh->begin_bulk_theme_override(); refresh->add_theme_color_override("icon_normal_color", theme_cache.icon_normal_color); refresh->add_theme_color_override("icon_hover_color", theme_cache.icon_hover_color); refresh->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color); refresh->add_theme_color_override("icon_pressed_color", theme_cache.icon_pressed_color); + refresh->end_bulk_theme_override(); + show_hidden->begin_bulk_theme_override(); show_hidden->add_theme_color_override("icon_normal_color", theme_cache.icon_normal_color); show_hidden->add_theme_color_override("icon_hover_color", theme_cache.icon_hover_color); show_hidden->add_theme_color_override("icon_focus_color", theme_cache.icon_focus_color); show_hidden->add_theme_color_override("icon_pressed_color", theme_cache.icon_pressed_color); + show_hidden->end_bulk_theme_override(); invalidate(); } break; diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 28f5ed7dfde..dfaf7d88b7c 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1108,10 +1108,12 @@ void PopupMenu::_notification(int p_what) { } // Set margin on the margin container + margin_container->begin_bulk_theme_override(); margin_container->add_theme_constant_override("margin_left", theme_cache.panel_style->get_margin(Side::SIDE_LEFT)); margin_container->add_theme_constant_override("margin_top", theme_cache.panel_style->get_margin(Side::SIDE_TOP)); margin_container->add_theme_constant_override("margin_right", theme_cache.panel_style->get_margin(Side::SIDE_RIGHT)); margin_container->add_theme_constant_override("margin_bottom", theme_cache.panel_style->get_margin(Side::SIDE_BOTTOM)); + margin_container->end_bulk_theme_override(); } } break; } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index b757b516d19..481f8f41318 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -191,6 +191,8 @@ void TabContainer::_on_theme_changed() { return; } + tab_bar->begin_bulk_theme_override(); + tab_bar->add_theme_style_override(SNAME("tab_unselected"), theme_cache.tab_unselected_style); tab_bar->add_theme_style_override(SNAME("tab_hovered"), theme_cache.tab_hovered_style); tab_bar->add_theme_style_override(SNAME("tab_selected"), theme_cache.tab_selected_style); @@ -217,6 +219,8 @@ void TabContainer::_on_theme_changed() { tab_bar->add_theme_constant_override(SNAME("icon_max_width"), theme_cache.icon_max_width); tab_bar->add_theme_constant_override(SNAME("outline_size"), theme_cache.outline_size); + tab_bar->end_bulk_theme_override(); + _update_margins(); if (get_tab_count() > 0) { _repaint();