godotengine / godot

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

Frame Selection (2D) / Focus Selection (3D) shortcut doesn't work reliably when focusing Scene tree (and if shortcut is a letter, selects node starting with that letter instead) #76947

Open hsandt opened 1 year ago

hsandt commented 1 year ago

Godot version

v4.0.2.stable.official [7a0977ce2]

System information

Linux Ubuntu 22.04 with Unity desktop

Issue description

Moved from https://github.com/godotengine/godot-proposals/discussions/6853

Most of the time, when I use the 2D Frame Selection shortcut F (or Shift+F, apparently the new default) or 3D Focus Selection F, I have just selected the node in the Scene tree (otherwise I would already have it in scene view), so the Scene tree is focused. Pressing the shortcut at that moment will fail to focus on selection. If the shortcut is one letter (optionally with Shift), the Scene tree panel will focus the next node whose name starts with that letter (e.g. Floor) instead.

Inconsistency:

To make Focus truly work, you must click on the Scene view first, then use the shortcut, but it's cumbersome.

I think we should give priority to any meaningful shortcut when Scene tree is focused. The only feature we'd "lose" is if the user really wants to search for a node whose name starts with F. But I suppose the default for 2D was switched to Shift+F precisely to distinguish the two use cases (and reversely, a user could decide to revert it to F as it's the most common operation, and only press "Shift+F" to search for a node whose name starts with F).

I suppose this could then be documented somewhere.

Also, if we really want to support first letter searching we should fix the bug that blocks it sometimes, to make it work reliably.

Steps to reproduce

  1. Create a scene with nodes with various names, some starting with F like "Floor", and at different positions, in 2D and/or 3D
  2. Move the scene view away
  3. Verify your current shortcut for Frame Selection (2D) / Focus Selection (3D): it should be F or Shift+F (you can try other letters too, or even F4).
  4. Select a node and press the corresponding shortcut for the dimension (below, we assume the shortcut is F to simplify) => the nodes whose name start with F are selected
  5. Press F more times => selection iterates over more nodes whose name start with F, but does not focus
  6. Try various letters and press them multiple times => it may select nodes based on their names, but sometimes the selection just fails and nothing happens
  7. Focus the scene view and press F => this time, the view frames / focus on the selected node or group of nodes
  8. Repeat 4-7 with various shortcuts, letters or not

Minimal reproduction project

N/A

Calinou commented 1 year ago

I think we should give priority to any meaningful shortcut when Scene tree is focused. The only feature we'd "lose" is if the user really wants to search for a node whose name starts with F. But I suppose the default for 2D was switched to Shift+F precisely to distinguish the two use cases (and reversely, a user could decide to revert it to F as it's the most common operation, and only press "Shift+F" to search for a node whose name starts with F).

I'm not fond of having incremental search work for all letters except F. I'd prefer changing the shortcut to focus the selection instead (even though I like F for that purpose).

hsandt commented 1 year ago

There is indeed a choice to make about priority, when we enable Scene View shortcuts while Scene Tree is focused. Ideally we'd let the user set their favorite context to detect a shortcut, but that requires a more elaborate shortcut editing system (like VS Code).

Otherwise, we must hardcode priority in advance, but then we must make a statement and align all default shortcuts to match this (I'm thinking about Shift+F for 2D vs F for 3D in particular).

I also realized there are other pure letter shortcuts like the transform tools QWER... I didn't really pay attention to it so far because I generally focus the scene when moving nodes around, but I could imagine a user selecting a node in the Scene Tree then W to translate it. I just checked Unity and... it doesn't have node selection by first letter at all.

To sum up the possibilities: a. Any existing shortcut gets priority over name search. In this case, we allow Shift + Letter to still search Letter. Advantage: we can use F, QWER, etc. Disadvantage: we cannot search nodes whose names start with just F, QWER, etc. but it's possible using Shift + Letter. b. Any simple letter press always searches nodes by name. However shortcuts with modifier (including Shift this time) work even when Scene Tree is focused. Advantage: searching node is consistent. Disadvantage: just F won't work, but user can always add a shortcut Shift+Letter to make it work. While Shift+F is OK, they probably won't want to use Shift+QWER for every transform tool, but Godot allows to add additional shortcuts, so they could be added as alternative shortcuts. c. Add an option to switch priority between a. and b. d. Add an option to disable searching nodes by node when typing letter entirely. Better combined with a. Users who don't need node search by first letter can check the option so they can just use F to focus.

Options c and d require more work, but that's much less work that a full VSCode-style shortcut editor with custom context field.

savioti commented 1 year ago

I'm also struggling with this in Windows, having a hard time locating nodes on the scene.