diff options
author | kobewi <kobewi4e@gmail.com> | 2021-02-27 19:24:59 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2021-02-27 19:24:59 +0100 |
commit | 5e4ab202964e05da65e4c992c8b5560b708c802f (patch) | |
tree | 1f542eb82921c9839893cd6cc77944e60402c6d2 | |
parent | 0e8fae1038cb27372777623b1af26e6f0cfb34fa (diff) |
Warn about changing size only when it's relevant
-rw-r--r-- | scene/gui/control.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 0c104bf318..4dc749964e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -509,7 +509,9 @@ void Control::_notification(int p_notification) { get_viewport()->_gui_remove_control(this); } break; case NOTIFICATION_READY: { +#ifdef DEBUG_ENABLED connect("ready", callable_mp(this, &Control::_clear_size_warning), varray(), CONNECT_DEFERRED | CONNECT_ONESHOT); +#endif } break; case NOTIFICATION_ENTER_CANVAS: { @@ -1709,8 +1711,8 @@ void Control::set_rect(const Rect2 &p_rect) { 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()."); + if (data.size_warning && (data.anchor[SIDE_LEFT] != data.anchor[SIDE_RIGHT] || data.anchor[SIDE_TOP] != data.anchor[SIDE_BOTTOM])) { + WARN_PRINT("Nodes with non-equal opposite anchors will have their size overriden after _ready(). \nIf you want to set size, change the anchors or consider using set_deferred()."); } #endif set_size(p_size); |