godotengine / godot

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

Involuntary object transformations, due to freeform mouse drag handling in viewport #87608

Open ratkingsminion opened 9 months ago

ratkingsminion commented 9 months ago

Tested versions

I'm using v4.2.stable.official [46dc27791]

System information

Windows 10; only tested in 3D, might be the same in 2D

Issue description

I often accidentally move or rotate nodes a tiny bit around. I often notice that much later. This is especially annoying with objects that are supposed to be in precise locations, like parts of build kits.

Steps to reproduce

The four modes Select, Move, Rotateand Scale Mode allow moving/rotating/scaling the currently selected object(s) even when the cursor is not near the gizmo or the object is actually seen on screen. I understand the upside: this allows transforming objects based on the current viewport space, instead of world/object space. But this also makes it very easy to accidentally transform things with one or more misplaced clicks.

Another minor gripe: in Move/Rotate/Scale Mode, even if you just click without actually dragging (mostly because I always forget that I can't select another object if I'm not in Select Mode), it creates an entry in the undo history.

So I guess the main question is if there is a way to block Godot from moving 3D objects in Select or any of the Translation Modes if I click/drag the cursor in the scene but not hovering the gizmo? In any case I would rather propose to extend the "Use Local Space (T)" button to allow switching between global/local/viewport, and get rid of the input recognition outside of the gizmo.

Minimal reproduction project (MRP)

N/A

ratkingsminion commented 9 months ago

I changed the title, maybe it makes it a bit more clear that this a problem.

Also, as an addendum, when testing this: The mouse dragging leading to the transformation is only registered if it starts over other objects - not over the background.

ryevdokimov commented 9 months ago

The issue with the history will be resolved with #87161

Maybe, this could be improved by having transforms done outside the gizmo require modifier keys (alt/shift/ctrl)?

The select tool of both 2D and 3D already do something like.

ratkingsminion commented 9 months ago

Yeah; another idea would be to (de)activate this kind of transform via an option in the Editor settings.

ryevdokimov commented 9 months ago

I think I've read somewhere the maintainers don't like that kind trivial behavior tucked away in the editor settings, since it's ends up not being used by 99% of people, and just forgotten about, so it becomes clutter. You can try the PR I made above a shot, let me know what you think: Testing pull requests

Edit: I think you're right about it being an Editor setting otherwise a PR would never be accepted due to breaking compatibility. I modified the PR to do this.

Cammymoop commented 9 months ago

This behavior in 3D Select Mode is a bug #85736