godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Implement more GridMap editor keyboard shortcuts (similar to Trackmania) #11173

Open geowarin opened 2 days ago

geowarin commented 2 days ago

Describe the project you are working on

A 3d game

Describe the problem or limitation you are having in your project

GridMap editing requires a lot of back and forth between keyboard and mouse because some actions are only available with the mouse (like placing blocks)

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

This idea was first suggested by @Calinou (https://github.com/godotengine/godot-proposals/issues/10992#issuecomment-2476527393)

Trackmania shortcuts are described here: https://wiki.trackmania.io/en/content-creation/map-editor

image

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Allow user to move the cursors using the keyboard

Using arrow keys to move the selected mesh on the grid

Place the current mesh with the space bar

Since Trackmania is geared toward making a circuit, the cursor then auto-advances to the next voxel on the grid (using the circuit direction).

Since Godot's gridmap is more flexible, we could choose not to move forward at all, or use the current camera direction to move the cursor after placing a mesh.

This would allow users to make walls by holding the space bar.

Allow selection of meshes with the number keys

In the Trackmania editor, all the pieces are numbered.

It is possible to directly select pieces with keys 1-9. To select a piece with a number greater than 9, users can input the number 0 first.

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

No, gridmap is a core feature.

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

Making an extension would require re-coding a lot of gridmap features in gdscript

Nodragem commented 1 day ago

The 0-9 shortcuts would be great. The arrow keys + space may require more thinking though.

I would say that the priority is to polish the pointer+keyboard workflow atm. To sacrifice the space key is a big decision; and if we can use the space key to improve the pointer+keyboard interaction, it should be prioritised.

What I mean is that there are still many features that needs to be added/improved in the Gridmap (e.g. ability to select a cube, a square, a line; ability to select along XY, XZ, YZ), and we should keep the spacebar free for when designing these tools.

Other than that it should be easy to implement, as basically the spacebar would be read as a click. I wonder if another key could be used??

Hiiamwilliam commented 1 hour ago

If you were able to move the cursor via keyboard, it would be ideal if the 3D Viewport Camera followed it. Else, you could move the cursor out of view, which would require using the mouse again to force the cursor back into view. A good solution would be to ensure that at least the currently focused Viewport's Camera moves with the cursor so that it is always centered. This would need to apply to changing floors as well. I hope the GridMap Editor doesn't need to mess with the Viewport Editor to do this, as I think this is generally not accepted.

Also, I wonder how nicely keyboard navigation will work with a combination of rotated Camera + rotated GridMap. If you press "left", should it go global left, local left, or left according to the Camera? What about using different planes other than the default XZ? Things can get weird.

Spacebar could be used as "Apply action of current Mode". So in Paint Mode, if you have selected an item, pressing spacebar paints in the cursor position. If it's Erase Mode, it erases, etc. This way, even if future updates bring new Modes/functionalities, spacebar could still be recognized as "apply" key.

we should keep the spacebar free for when designing these tools

I think spacebar is too handy for the left hand to be made exclusive to future Selection-related tools. It's also a reliable key for different keyboard types and operational systems. Having said that, a possible non-spacebar usage of keys is pressing the Mode shortcuts to apply the action. So the same key is responsible for both changing to the Mode if not already there, and if it is, applying that action.

If I understand the new bottom panel update correctly, the top row numbers 1 and 3 are used, so directly pressing numbers to pick cell ID isn't possible. Seemingly 2 isn't bound, so maybe it could be chosen for a "quick select" functionality. So you would press 2, then numbers of the cell ID, then spacebar or Enter to select.

Alternatively, we could use a new key (maybe F) to trigger the Filter functionality. Relying on numbers to quick select meshes could make things difficult to remember: I think it's easier to Filter "door_wood" than quick selecting "23".