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

@ -219,25 +219,23 @@ void TextureLayeredEditor::edit(Ref<TextureLayered> 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() {