godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91k stars 21.17k forks source link

Camera2D's editor draw doesn't respect window stretch scale #91741

Open Grublady opened 6 months ago

Grublady commented 6 months ago

Tested versions

System information

Godot v4.3.dev6 - macOS 14.4.1 - Vulkan (Mobile) - integrated Apple M1 Max - Apple M1 Max (10 Threads)

Issue description

Camera2D's editor_draw_screen preview does not accurately reflect the screen rectangle when using a non-unity scaling factor for the display/window/stretch/scale project setting.

Editor preview (actual):

Editor preview (actual)

Running the scene:

Scene

Note how the drawn screen rectangle in the editor contains the entire sprite, whereas running the scene shows that the sprite actually eclipses the screen rectangle.

Expected editor preview, simulated by setting the Camera2D's zoom to the stretch scale:

Simulated expected editor preview

Steps to reproduce

Minimal reproduction project (MRP)

N/A

timothyqiu commented 6 months ago

Note that the camera is not necessarily affected by the main window. For example, the scene could be instantiated inside another SubViewport or popup window.