summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRichard Adenling <dreeze@gmail.com>2022-12-06 09:56:47 +0100
committerRichard Adenling <dreeze@gmail.com>2022-12-06 11:34:32 +0100
commita3d8a78f1b7bfe75f12b7d5a511e991e24b8ed79 (patch)
treea8152d9861a42cd711b82fe4077c6018d0d00d43 /scene/2d
parentf3e6750a7e4702918e05f42b1376e30e652f2f90 (diff)
Fix for 2D viewport not updating in the editor when the camera moves
This fixes a problem with 2D viewports not taking the camera position into consideration when previewed in the editor. Fixes #40441
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/camera_2d.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 4b31bbddac..229625ad6d 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -39,8 +39,11 @@ void Camera2D::_update_scroll() {
}
if (Engine::get_singleton()->is_editor_hint()) {
- queue_redraw(); //will just be drawn
- return;
+ queue_redraw();
+ // Only set viewport transform when not bound to the main viewport.
+ if (get_viewport() == get_tree()->get_edited_scene_root()->get_viewport()) {
+ return;
+ }
}
if (!viewport) {