From a89fa56bea8bba6e7b7200a4c4aef04a40ff38bb Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 20 Mar 2022 19:12:43 +0100 Subject: [PATCH] Backported: - Fix children visibility check (cherry picked from commit 280956d) - taigi100 - https://github.com/godotengine/godot/commit/b33eed23aef39db58dac563dc14d7110f16eca50 --- scene/gui/flow_container.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scene/gui/flow_container.cpp b/scene/gui/flow_container.cpp index 8bdd58a2a..d6d59de6e 100644 --- a/scene/gui/flow_container.cpp +++ b/scene/gui/flow_container.cpp @@ -41,6 +41,11 @@ struct _LineData { }; void FlowContainer::_resort() { + // Avoid resorting if invisible. + if (!is_visible_in_tree()) { + return; + } + int separation_horizontal = get_constant("hseparation"); int separation_vertical = get_constant("vseparation"); @@ -58,7 +63,7 @@ void FlowContainer::_resort() { // First pass for line wrapping and minimum size calculation. for (int i = 0; i < get_child_count(); i++) { Control *child = Object::cast_to(get_child(i)); - if (!child || !child->is_visible_in_tree()) { + if (!child || !child->is_visible()) { continue; } if (child->is_set_as_toplevel()) { @@ -128,7 +133,7 @@ void FlowContainer::_resort() { for (int i = 0; i < get_child_count(); i++) { Control *child = Object::cast_to(get_child(i)); - if (!child || !child->is_visible_in_tree()) { + if (!child || !child->is_visible()) { continue; } if (child->is_set_as_toplevel()) {