Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information