Add bulk change guards to successive theme overrides in Editor and GUI

This commit is contained in:
Yuri Sizov 2023-10-19 18:05:19 +02:00
parent f8818f85e6
commit 215e036600
24 changed files with 145 additions and 70 deletions

View file

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