Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Blender-inspired UI and shortcuts for transform tools in 3D editor #1215

Closed
5 of 6 tasks
rcorre opened this issue Jul 18, 2020 · 59 comments · Fixed by godotengine/godot#56543
Closed
5 of 6 tasks

Comments

@rcorre
Copy link

rcorre commented Jul 18, 2020

Describe the project you are working on:

FPS, but applies to almost any 3D project.

Describe the problem or limitation you are having in your project:

I find blenders UI for transforms to be very intuitive, fast, and accurate, specifically the following behavior:

  • Pressing g/r/s immediately enters grab(translate)/rotate/scale mode for the selected object(s),
    and translation is performed until you confirm or cancel (no need to hold a mouse button)
    Click confirms, ESC cancels (restoring the original transforms).
  • Pressing (shift)+x/y/z locks the transform to the specified axis/plane
  • Pressing xx/yy/zz locks the transform to the specified local axis
  • Hold ctrl to snap, shift for precise movement

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

Implement the above features in Godot's 3D editor.
This is a revival of godotengine/godot#19186.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

I think this can be broken up into several chunks. Maybe we don't take all of them, but some are low-hanging fruit that I think will provide a lot of benefit with little complexity:

  • Pressing (shift)+X/Y/Z locks the transform to an axis/plane while using a transform tool. Only process these keys while using a transform tool and the mouse is down.
    • These are configurable editor shortcuts, so you could swap z/y for a more blenderlike experience
    • Implemented at rcorre/godot@27b66ae
  • Pressing XX/YY/ZZ locks the transform to a local axis. Godot has local transforms already, maybe we can just toggle the setting for the duration of the transform.
    - Implemented in rcorre/godot@4bb6738
  • Hold shift for precision. Shift is already used to disable proportional scaling in planar mode 😖
    • Actually SHIFT already works while snapping
  • Optional bindings to activate a transform tool and use it without holding down the mouse (like blender's G/R/S)
  • Pressing ESC while using a transform tool undoes a transform
  • Highlight the transformation axis in the spatial gizmo. PoC here.

tmp

If this enhancement will not be used often, can it be worked around with a few lines of script?:

See the addon below. It isn't horrible, but it isn't "a few lines" either.

Is there a reason why this should be core and not an add-on in the asset library?:

I actually started work on an addon to do exactly this.
It is still a PoC but demonstrates much of the functionality I describe above.
However, I was looking through the Godot source and realized that most of this is already implemented.
For example, you can already cycle through axis locks by pressing the middle-mouse button while holding down the left-mouse button.
However, this is clumsy and hard to discover (I didn't realize it existed until I saw it in the source).

So this could be implemented as a plugin, but I got tired of re-implementing Godot's editor logic and decided to try patching the editor instead.

@Calinou Calinou changed the title Blender-inspired UI for transform tools in 3D editor Add Blender-inspired UI and shortcuts for transform tools in 3D editor Jul 18, 2020
@rcorre
Copy link
Author

rcorre commented Jul 18, 2020

I also realize most of the feedback on godotengine/godot#19186 was negative. I'm suggesting this because:

  1. I actually really like these aspects of Blender's UI and miss them a lot in Godot.
  2. I think these features can be invisible and unintrusive to anyone who doesn't like them.

@Calinou
Copy link
Member

Calinou commented Jul 18, 2020

@rcorre I definitely approve of having Vim-like shortcuts in the 3D editor. It's one of the cases where I actually managed to stick to Vim-like shortcuts (unlike actual text editing).

@Jummit
Copy link

Jummit commented Jul 18, 2020

I know some FOSS users coming from Blender to Godot who are used to the highly efficient keyboard shortcuts of Blender and would greatly appreciate something similar in Godot.
I think in this case both built-in and an addon would work.

@jonbonazza
Copy link

Im not very experienced in blender, but i agree having better shortcuts when working in the 3d editor would be very much appreciated. It's a pain currently to modify transform properties of 3d objects since you have to go back and firth between clicking the gizmo buttons way in the upper left of viewport and clicking objects in the viewport, wgich are usually very far away from the gizmo buttons.

rcorre added a commit to rcorre/godot that referenced this issue Jul 19, 2020
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.

When we handle a key during a transform, we need to accept/return so it
doesn't cascade through. In particular, without this "Y" will toggle
snap mode unintentionally.

See godotengine/godot-proposals#1215.
rcorre added a commit to rcorre/godot that referenced this issue Jul 19, 2020
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.

See godotengine/godot-proposals#1215.
rcorre added a commit to rcorre/godot that referenced this issue Jul 20, 2020
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).

See godotengine/godot-proposals#1215.
rcorre added a commit to rcorre/godot that referenced this issue Jul 20, 2020
This adds shortcuts for "instant" transforms, where you can press the
key and immediately be transforming an object without holding the mouse
then click to commit the transformation (or ESC to abort).

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.

See godotengine/godot-proposals#1215.
@rcorre
Copy link
Author

rcorre commented Jul 21, 2020

I've implemented all of this (except shift-for precision*) on 3.2.2-stable over here. I'm happy to port to 4.0 if there's an interest.

* shift-for-precision is tricky as the current code doesn't accumulate motion, it just compares the current mouse position to the position when you started the transform. This means holding shift will suddenly reset your transform to an earlier point (rather than just adding smaller increments to the current amount, as blender does). I didn't think this was useful enough to significantly change the current transform code (espeicially since shift already works for snap mode, enabling smaller snap increments).

@SecretPanda420
Copy link

SecretPanda420 commented Jul 22, 2020

@rcorre Another great addition can be improving the numpad controls in the editor inspired from Blender. As of now Godot only uses nkeys 7, 1, 3 for changing between top, front and side view and nkey 5 for toggling between perspective and orthogonal view. Keys 2, 6, 4 and 8 can be used to change view 15 degrees around in respective directions like in Blender and nkey 9 can be used to change view angle 180 degrees. As of now Godot only supports changing views using Alt + <N7,N1,N3> which can be a little tedious while working when other nkeys are just there serving no purpose when they actually can.

This is just a suggestion to improve this GIP. :)

@rcorre
Copy link
Author

rcorre commented Jul 22, 2020

Thanks @SecretPanda420! I don't think I've ever used 2/4/6/8 in Blender, but maybe I should try 😆
I'll see if it is easy enough to implement, it sounds like it should be

@Calinou
Copy link
Member

Calinou commented Jul 22, 2020

Keys 2, 6, 4 and 8 can be used to change view 45 degrees around in respective directions like in Blender

I support this idea, but I remember these hotkeys working by 15-degree increments, not 45-degree increments. (I just tested it in Blender 2.83.3; it takes 6 key presses to rotate by 90 degrees.)

@SecretPanda420
Copy link

I support this idea, but I remember these hotkeys working by 15-degree increments, not 45-degree increments. (I just tested it in Blender 2.83.3; it takes 6 key presses to rotate by 90 degrees.)

They are 15-degree increments indeed. My bad.

rcorre added a commit to rcorre/godot that referenced this issue Jul 23, 2020
Add blender-style numpad 2,4,6,8 shortcuts that pivot the view in
15-degree increments.

Mentioned in godotengine/godot-proposals#1215.
@rcorre
Copy link
Author

rcorre commented Jul 23, 2020

Implemented 3D view "orbiting" shortcuts (that is apparently what blender calls them) in eb483de30656f1edeb1aa5efd0e5cca4a4c275c6.

@SecretPanda420
Copy link

Implemented 3D view "orbiting" shortcuts (that is apparently what blender calls them) in eb483de30656f1edeb1aa5efd0e5cca4a4c275c6.

Might as well add N9 for changing view 180 degrees. Other than that, looks perfect. I would add it myself but I'm not on my PC atm. :p

@GeorgeS2019
Copy link

@rcorre @imjp94 I hope eventually there will be a list to track and to coordinate Godot Addon that are porting ideas from Blender to Godot. This makes perfect as this will just encourage more blender users to try Godot. Great job!

rcorre added a commit to rcorre/godot that referenced this issue Jan 23, 2022
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).
@akien-mga akien-mga added this to the 4.0 milestone Feb 8, 2022
@RichardJECooke
Copy link

I see this is closed. Is it possible to use Blender shortcuts in Godot yet please? It's very difficult trying to switch between the two apps shortcuts in my head

@rcorre
Copy link
Author

rcorre commented Sep 2, 2023

@RichardJECooke yes, but you must manually assign the shortcuts, as some of them conflict with bultin shortcuts: #1215 (comment)

For anyone trying it out, remember you must manually assign the following keybinds:

Begin Translate Transformation
Begin Rotate Transformation
Begin Scale Transformation
So those should be g, r, and s if you want it to work like the Blender defaults.

@RichardJECooke
Copy link

If I have to manually copy and paste every one of Blender's shortcuts into Godot's options manually, then what is the point of this issue? Is there no way to switch on Blender shortcuts automatically? I don't understand.

@Zireael07
Copy link

The point of this issue, AIUI, is to have those options at all.

@RichardJECooke
Copy link

RichardJECooke commented Sep 2, 2023

But doesn't Godot already have translate/rotate/scale, select, zoom, pan, etc?

@Zireael07
Copy link

It does, but Blender's behavior is different in that it immediately enters the mode (you press the button and it immediately scales the model). In Godot, you need another click or two.

At the time this proposal was created, Godot didn't have locking to global or local axis AT ALL IIRC.

@Calinou
Copy link
Member

Calinou commented Sep 2, 2023

godotengine/godot#78148 implements default shortcuts for Blender-style transform options, but it's not guaranteed to be merged due to godotengine/godot#78148 (comment).

@bitinn
Copy link

bitinn commented Sep 9, 2023

Hi, a question regarding this feature:

  • In Blender (and other popular game engines), users are still able to select another object or de-select current object when using one of the transform mode, but it seems in Godot this is not possible?

  • Have similar proposals been made regarding this aspect?

@rcorre
Copy link
Author

rcorre commented Sep 9, 2023

@bitinn I'm not aware of a way to de-select the current object or select another object in the middle of a transform in Blender. Can you explain how to do that?

@bitinn
Copy link

bitinn commented Sep 9, 2023

@rcorre hi, I meant Blender has this option to delay immediate transform, which means you don't immediate move/rotate/scale object:

Screenshot 2023-09-09 at 23 27 35

This is actually closer to Godot 4's current behavior, you press W/E/R to enter transform mode, but it won't immediate move/rotate/scale the node, you need to hold mouse left button + drag to trigger that.

Since Blender with such settings can de-select active object or select another object. I feel Godot 4 is missing some key convenience here. (Also because this is standard among 2 other major game engines.)

@rcorre
Copy link
Author

rcorre commented Sep 9, 2023

I still can't figure out where that option is. However, I think what you're describing merits a separate issue. This issue was specifically for the "Immediate" style tranforms.

@bitinn
Copy link

bitinn commented Sep 9, 2023

@rcorre for reference, under Blender 3.6 LTS, it is available if you use the default blender keymap:

Screenshot 2023-09-10 at 1 12 24

But yes this needs to be done in a separate proposal, my question was whether this is by-design, because the current behavior is in Godot 4 is more like Active Tool than Immediate. Pressing W for example won't allow me to move the node immediately, Immediate mode in Blender doesn't require holding the left button.

@rcorre
Copy link
Author

rcorre commented Sep 10, 2023

The current behavior is in Godot 4 is more like Active Tool than Immediate

The default behavior in Godot4 is more like Active Tool than Immediate. If you want Immediate-style transforms, bind the following editor shortcuts:

  • Begin Translate Transformation
  • Begin Rotate Transformation
  • Begin Scale Transformation

These are not bound by default as they conflict with the builtin bindings.

The number of questions we're getting suggest this feature is not very discoverable, but I'm not sure what do do about that.

@bitinn
Copy link

bitinn commented Sep 10, 2023

Just to be clear, I want the Active Tool style behavior, but I am simply missing the part where Blender offers to select another object/deselect current object when Active Tool style is used. Either way, this warrants a new proposal probably.

@mathphye
Copy link

mathphye commented Oct 3, 2023

The current behavior is in Godot 4 is more like Active Tool than Immediate

The default behavior in Godot4 is more like Active Tool than Immediate. If you want Immediate-style transforms, bind the following editor shortcuts:

  • Begin Translate Transformation
  • Begin Rotate Transformation
  • Begin Scale Transformation

These are not bound by default as they conflict with the builtin bindings.

The number of questions we're getting suggest this feature is not very discoverable, but I'm not sure what do do about that.

What about showing a list of shortcuts available? (As Blender does too)

"Show insights into what shortcuts are available in the current context" #7976

@rcorre
Copy link
Author

rcorre commented Oct 4, 2023

What about showing a list of shortcuts available? (As Blender does too)

This would only help for shortcuts that are bound by default. These are not, as they conflict with builtin shortcuts. So "s" would show as "Scale Tool", not "Begin Scale Transformation".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.