From 96d38d97514241fddfee2dffab9866c0a712205e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 25 Feb 2021 15:00:49 +0100 Subject: [PATCH] Revert "Warn when setting Control size inside ready()" This reverts commit a8105d73c7eac8998a90bb02c10aeb0da6002a76. We need to improve the logic somewhat to make the warning more specific to actual problematic scenarios. Will likely be cherry-picked again + fixes for the next release. Fixes #46376. --- scene/gui/control.cpp | 15 +-------------- scene/gui/control.h | 2 -- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 332054f507d..829daedd25c 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -433,10 +433,6 @@ void Control::_resize(const Size2 &p_size) { _size_changed(); } -void Control::_clear_size_warning() { - data.size_warning = false; -} - //moved theme configuration here, so controls can set up even if still not inside active scene void Control::add_child_notify(Node *p_child) { @@ -488,9 +484,7 @@ void Control::_notification(int p_notification) { case NOTIFICATION_EXIT_TREE: { get_viewport()->_gui_remove_control(this); - } break; - case NOTIFICATION_READY: { - connect("ready", this, "_clear_size_warning", varray(), CONNECT_DEFERRED | CONNECT_ONESHOT); + } break; case NOTIFICATION_ENTER_CANVAS: { @@ -1835,11 +1829,6 @@ void Control::set_position(const Size2 &p_point, bool p_keep_margins) { } void Control::_set_size(const Size2 &p_size) { -#ifdef DEBUG_ENABLED - if (data.size_warning) { - WARN_PRINT("Adjusting the size of Control nodes before they are fully initialized is unreliable. Consider deferring it with set_deferred()."); - } -#endif set_size(p_size); } @@ -2964,8 +2953,6 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("_override_changed"), &Control::_override_changed); - ClassDB::bind_method(D_METHOD("_clear_size_warning"), &Control::_clear_size_warning); - BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size")); diff --git a/scene/gui/control.h b/scene/gui/control.h index 1836e4bd1ab..3d47e7ce5ee 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -160,7 +160,6 @@ private: float rotation; Vector2 scale; Vector2 pivot_offset; - bool size_warning = true; bool pending_resize; @@ -225,7 +224,6 @@ private: void _change_notify_margins(); void _update_minimum_size(); - void _clear_size_warning(); void _update_scroll(); void _resize(const Size2 &p_size);