浏览代码

Add size warning to Viewport Node

(cherry picked from commits 855f4dc1930007f13f32bed5572aa812e32f9e63
and 760095e28d7ff1f6cce2f0c2458978f725264320)
Rasmus Vermeulen 5 年之前
父节点
当前提交
5c64458d9e
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      scene/main/viewport.cpp

+ 3 - 1
scene/main/viewport.cpp

@@ -2981,12 +2981,14 @@ Control *Viewport::get_modal_stack_top() const {
 }
 
 String Viewport::get_configuration_warning() const {
-
 	/*if (get_parent() && !Object::cast_to<Control>(get_parent()) && !render_target) {
 
 		return TTR("This viewport is not set as render target. If you intend for it to display its contents directly to the screen, make it a child of a Control so it can obtain a size. Otherwise, make it a RenderTarget and assign its internal texture to some node for display.");
 	}*/
 
+	if (size.x == 0 || size.y == 0) {
+		return TTR("Viewport size must be greater than 0 to render anything.");
+	}
 	return String();
 }