From e93d2a04df0c1573c8e2def3409f2fbeb3fc22a6 Mon Sep 17 00:00:00 2001 From: Rakka Rage Date: Thu, 24 Aug 2023 13:34:05 -0400 Subject: [PATCH] Call `add_child` after `set_rect` to fix size bug --- editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 4e8c28e99789..11f38cd6817c 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -955,7 +955,6 @@ void TileSetAtlasSourceEditor::_update_atlas_view() { // Create and position the button. Button *button = memnew(Button); - alternative_tiles_control->add_child(button); button->set_flat(true); button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); button->add_theme_style_override("normal", memnew(StyleBoxEmpty)); @@ -965,6 +964,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() { button->connect("pressed", callable_mp(tile_set_atlas_source, &TileSetAtlasSource::create_alternative_tile).bind(tile_id, TileSetSource::INVALID_TILE_ALTERNATIVE)); button->set_rect(Rect2(Vector2(pos.x, pos.y + (y_increment - texture_region_base_size.y) / 2.0), Vector2(texture_region_base_size_min, texture_region_base_size_min))); button->set_expand_icon(true); + alternative_tiles_control->add_child(button); pos.y += y_increment; }