godotengine / godot

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

Half Resolution breaks path editing. #41586

Open shayneoneill opened 4 years ago

shayneoneill commented 4 years ago

Godot version:

Godot 3.2.2 rc2 mono

OS/device including version: Macbook Pro 2015, Big Sur

Issue description: When "Half Resolution" is enabled in the editor perspective menu, placing points on a path in 3D mode (maybe 2D, not tested) places the point a distance from the cursor in screen space at a point twice the distance from the top left corner of the

Steps to reproduce:

  1. Set up 3D scene with "Path" node.
  2. Turn on half-resolution mode in Perspective -> Half-resolution -> On.
  3. Click Add Point
  4. Attempt to place point.
  5. Note the displaced location its placed.
  6. Click OFF Half Resolution
  7. Add point again and observe correct behavior

In Attached illustation, a control point was attempted to be placed in top left corner of hallways, but instead point added in location shown.

Screen Shot 2020-08-29 at 3 24 03 am

My suggestion is that the point editing code does not correctly translate the mouse position relative to top corner in half-resolution mode (Presumably the correct value is aquired by dividing the screen space X/Y coords by too

Calinou commented 4 years ago

The fix should be similar to https://github.com/godotengine/godot/pull/33940, but the same issue with handling multiple viewports (that can use different resolutions) remains.

Edit: In master, we can use Viewport's scale_3d property instead of relying on Viewport shrinking. This property isn't available in 3.x though, and it's not trivial to backport there.