Browse Source

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
Richard Adenling 2 years ago
parent
commit
a3d8a78f1b
1 changed files with 5 additions and 2 deletions
  1. 5 2
      scene/2d/camera_2d.cpp

+ 5 - 2
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) {