Просмотр исходного кода

Add size warning to Viewport Node

Rasmus Vermeulen 5 лет назад
Родитель
Сommit
855f4dc193
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      scene/main/viewport.cpp

+ 3 - 1
scene/main/viewport.cpp

@@ -2948,12 +2948,14 @@ Control *Viewport::get_modal_stack_top() const {
 }
 }
 
 
 String Viewport::get_configuration_warning() const {
 String Viewport::get_configuration_warning() const {
-
 	/*if (get_parent() && !Object::cast_to<Control>(get_parent()) && !render_target) {
 	/*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.");
 		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("This viewport can't render anything.\nConsider increasing the size.");
+	}
 	return String();
 	return String();
 }
 }