diff options
author | Ryan Roden-Corrent <ryan@rcorre.net> | 2020-07-18 15:03:08 -0400 |
---|---|---|
committer | Ryan Roden-Corrent <ryan@rcorre.net> | 2022-01-22 20:55:39 -0500 |
commit | 58e8e5f219d821056750d446da8e349049e9174b (patch) | |
tree | 863325810680e33904984958684d8860bc1be5e0 /editor/scene_tree_dock.cpp | |
parent | 366d3930ac96db5561afd23b1063085fccf6dcd6 (diff) |
Implement blender-style 3D transform tools.
See godotengine/godot-proposals#1215.
This adds shortcuts for blender-inspired transforms, where you can press
the key and immediately be transforming an object without holding the
mouse. Clicking commits the transformation, ESC aborts it.
This is inspired by Blender's G(rab)/R(otate)/S(cale) shortcuts, but I
decided not to add default bindings as `S` is already bound to the
regular scale tool, and it might be confusing to only bind some of them.
While actively using a transform tool, you can press X/Y/Z to lock the
transform to an axis or (shift)+X/Y/Z to constrain the transform to a
plane. These keys are only processed if you have a transform tool
(translate/rotate/scale) active _and_ the mouse button is held.
Pressing XX/YY/ZZ will lock the transform to a local (rather than
global) axis.
This is achieved by temporarily toggling the local transform button. I
did this (vs handling it in the transform functions) for 3 reasons:
- Transform logic for translate/rotate (but not scale) appears to be
tightly coupled to the gizmo
- This ensures the gizmo changes to indicate we're transforming
locally/globally
- Toggling the button state in the UI also gives the user feedback about
the nature of the transform.
The original state of the button is reset when the transform completes.
Pressing the `spatial_editor/cancel_transform` shortcut key during a
transform operation will cancel the transform and reset the objects back
to their original transforms.
This functionality was already accessible by pressing RMB during a
transform, however:
- ESC is more familiar to blender users, and a more common "cancel" key
in general.
- Given you must hold LMB during a transform, pressing RMB as well is
clumsy if not impossible (on a laptop trackpad).
Diffstat (limited to 'editor/scene_tree_dock.cpp')
0 files changed, 0 insertions, 0 deletions