From 0cc315956363124854dae575e238427c74833bce Mon Sep 17 00:00:00 2001 From: Ayush Singla Date: Tue, 27 Dec 2022 18:16:55 +0530 Subject: [PATCH] Fixed: Camera3D has an incorrect shape before opening the 2D tab --- scene/main/viewport.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index fdbcb20d3005..5f473cfc670f 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -859,8 +859,8 @@ bool Viewport::_is_size_allocated() const { Rect2 Viewport::get_visible_rect() const { Rect2 r; - if (size == Size2()) { - r = Rect2(Point2(), DisplayServer::get_singleton()->window_get_size()); + if (is_inside_tree() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->get_parent() == get_viewport()) { + r = Rect2(Point2(), Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"))); } else { r = Rect2(Point2(), size); }