Add bulk change guards to successive theme overrides in Editor and GUI
This commit is contained in:
parent
f8818f85e6
commit
215e036600
24 changed files with 145 additions and 70 deletions
|
|
@ -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<StyleBoxFlat> 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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue