From d567369c8fa9bf801977c7e728ece65fcb6cfa64 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 1 Oct 2021 16:36:28 +0200 Subject: [PATCH] =?UTF-8?q?Tweak=20the=20Viewport=20configuration=20warnin?= =?UTF-8?q?g=20to=20mention=202=C3=972=20size=20requirement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/classes/SubViewport.xml | 2 +- scene/main/viewport.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/classes/SubViewport.xml b/doc/classes/SubViewport.xml index b62c294f2c61..7020cae1de6d 100644 --- a/doc/classes/SubViewport.xml +++ b/doc/classes/SubViewport.xml @@ -25,7 +25,7 @@ The update mode when the sub-viewport is used as a render target. - The width and height of the sub-viewport. + The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed. The 2D size override of the sub-viewport. If either the width or height is [code]0[/code], the override is disabled. diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 5fef8d4b5f74..8f1fedaac2ec 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -821,6 +821,7 @@ void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, RS::get_singleton()->viewport_set_size(viewport, 0, 0); } _update_global_transform(); + update_configuration_warnings(); update_canvas_items(); @@ -2821,8 +2822,8 @@ Variant Viewport::gui_get_drag_data() const { TypedArray Viewport::get_configuration_warnings() const { TypedArray warnings = Node::get_configuration_warnings(); - if (size.x == 0 || size.y == 0) { - warnings.push_back(RTR("Viewport size must be greater than 0 to render anything.")); + if (size.x <= 1 || size.y <= 1) { + warnings.push_back(RTR("The Viewport size must be greater than or equal to 2 pixels on both dimensions to render anything.")); } return warnings; }