UI: Type To Search And Space Bar Search #113520

Merged
Harley Acheson merged 4 commits from Harley/blender:CombinedMenuSearch into blender-v4.0-release 2023-10-12 17:55:07 +02:00
Member

Continue allowing spacebar search for all dropdown and context menus,
but also add the ability to allow some menus to have type to search,
like Add Modifiers, Objects, Nodes.


As discussed in our UI Module Meeting, this PR adds the ability to specify that specific menus have "type to search" (by adding menu option SEARCH_ON_KEY_PRESS), while keeping the "spacebar to search" available for all regular dropdown and context menus.

This is largely just putting lots of @JacquesLucke's code back in, with some changes needed to have the two searches coexist.

One difference is that this PR adds SEARCH_ON_KEY_PRESS to the submenus of the "Add" menus. Otherwise you could search submenus with space bar but not with type to search.

Similarly the code in interface_handlers.cc is a bit different to allow more specific "pass event to parent" behavior for searches than for accelerator keys. In a nutshell if you have just opened a menu but no submenus are activated (your mouse is over the main list) we want to search the parent, not the child. However if the child is not directly searchable (without a name, probably because it is an enum menu) then search the parent because it will include the child items.

One decision taken here is that when dropdown menus are opened they all continue to show "Press spacebar to search..." even if they also have "type to search enabled". This is just because it looked odd to see the odd one show something different. It isn't wrong, in that space bar search works there of course, but it just doesn't add anything about type to search.

This PR adds a "Search" item to these menus. You can click on it to start search, but it also is an indication that this menu is different.

image

I think this addresses all the issues we discussed.

Continue allowing spacebar search for all dropdown and context menus, but also add the ability to allow some menus to have type to search, like Add Modifiers, Objects, Nodes. --- As discussed in our [UI Module Meeting](https://devtalk.blender.org/t/2023-10-10-user-interface-meeting/31324), this PR adds the ability to specify that specific menus have "type to search" (by adding menu option SEARCH_ON_KEY_PRESS), while keeping the "spacebar to search" available for all regular dropdown and context menus. This is largely just putting lots of @JacquesLucke's code back in, with some changes needed to have the two searches coexist. One difference is that this PR adds SEARCH_ON_KEY_PRESS to the submenus of the "Add" menus. Otherwise you could search submenus with space bar but not with type to search. Similarly the code in `interface_handlers.cc` is a bit different to allow more specific "pass event to parent" behavior for searches than for accelerator keys. In a nutshell if you have just opened a menu but no submenus are activated (your mouse is over the main list) we want to search the parent, not the child. However if the child is not directly searchable (without a name, probably because it is an enum menu) then search the parent because it will include the child items. One decision taken here is that when dropdown menus are opened they all continue to show "Press spacebar to search..." even if they also have "type to search enabled". This is just because it looked odd to see the odd one show something different. It isn't wrong, in that space bar search works there of course, but it just doesn't add anything about type to search. This PR adds a "Search" item to these menus. You can click on it to start search, but it also is an indication that this menu is different. ![image](/attachments/4195ed57-d3a2-494c-ac86-cf88542d5075) I think this addresses all the issues we discussed.
Harley Acheson added 1 commit 2023-10-10 23:34:00 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
8d6b399aa8
UI: Type To Search And Space Bar Search
Continue allowing spacebar search for all dropdown and context menus,
but also add the ability to allow some menus to have type to search,
like Add Modifiers, Objects, Nodes.
Harley Acheson changed title from UI: Type To Search And Space Bar Search to UI: Type To Search And Space Bar Search 2023-10-10 23:36:01 +02:00
Harley changed target branch from main to blender-v4.0-release 2023-10-10 23:36:03 +02:00
Harley Acheson added this to the User Interface project 2023-10-10 23:36:26 +02:00
Harley Acheson requested review from Jacques Lucke 2023-10-10 23:36:46 +02:00
Harley Acheson requested review from Pablo Vazquez 2023-10-10 23:36:53 +02:00
Harley Acheson requested review from Dalai Felinto 2023-10-10 23:37:11 +02:00
Harley Acheson requested review from Julian Eisel 2023-10-10 23:37:23 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR113520) when ready.
Jacques Lucke approved these changes 2023-10-11 10:47:24 +02:00
@ -10769,0 +10780,4 @@
/* Menu search if spacebar or SearchOnKeyPress. */
MenuType *mt = WM_menutype_find(menu->menu_idname, false);
if (mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) || event->type == EVT_SPACEKEY) {
Member
/home/jacques/blender/blender/source/blender/editors/interface/interface_handlers.cc: In function ‘int ui_handle_menu_event(bContext*, const wmEvent*, uiPopupBlockHandle*, int, bool, bool, bool)’:
/home/jacques/blender/blender/source/blender/editors/interface/interface_handlers.cc:10783:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
10783 |             if (mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) || event->type == EVT_SPACEKEY) {
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``` /home/jacques/blender/blender/source/blender/editors/interface/interface_handlers.cc: In function ‘int ui_handle_menu_event(bContext*, const wmEvent*, uiPopupBlockHandle*, int, bool, bool, bool)’: /home/jacques/blender/blender/source/blender/editors/interface/interface_handlers.cc:10783:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] 10783 | if (mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) || event->type == EVT_SPACEKEY) { | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
Harley marked this conversation as resolved
First-time contributor

Thanks @Harley,
just tested the patch and it works perfectly! Seems like a great solution :) Getting the best of both worlds! Thanks again!

Thanks @Harley, just tested the patch and it works perfectly! Seems like a great solution :) Getting the best of both worlds! Thanks again!
First-time contributor

I think this solution is better than previous pure spacebar search, but to me it still raises some questions.
Different people have different preferences on search Vs. accelerator key, and more importantly it's inconsistent with different behaviors in different menus.
I think since we can assign shortcut to search function. is "type to search" really necessary? If people want "type to search", they can assign shortcut to search by themselves to directly call search functions. In that case, we are giving users options to choose as they always ask for.
image

I think this solution is better than previous pure spacebar search, but to me it still raises some questions. Different people have different preferences on search Vs. accelerator key, and more importantly it's inconsistent with different behaviors in different menus. I think since we can assign shortcut to search function. is "type to search" really necessary? If people want "type to search", they can assign shortcut to search by themselves to directly call search functions. In that case, we are giving users options to choose as they always ask for. ![image](/attachments/2edf0a1c-26bc-4e5f-902d-3cacd34ea558)
Contributor

I think this solution is better than previous pure spacebar search, but to me it still raises some questions.
Different people have different preferences on search Vs. accelerator key, and more importantly it's inconsistent with different behaviors in different menus.
I think since we can assign shortcut to search function. is "type to search" really necessary? If people want "type to search", they can assign shortcut to search by themselves to directly call search functions. In that case, we are giving users options to choose as they always ask for.
image

This is how it worked in 3.6 and previous but the big issue here is that this assumes only one menu per editor. So for example you would spend your type to search key on Add menu in the 3D View context, but the 4.0 idea is that all menus should be searchable.

> I think this solution is better than previous pure spacebar search, but to me it still raises some questions. > Different people have different preferences on search Vs. accelerator key, and more importantly it's inconsistent with different behaviors in different menus. > I think since we can assign shortcut to search function. is "type to search" really necessary? If people want "type to search", they can assign shortcut to search by themselves to directly call search functions. In that case, we are giving users options to choose as they always ask for. > ![image](/attachments/2edf0a1c-26bc-4e5f-902d-3cacd34ea558) > This is how it worked in 3.6 and previous but the big issue here is that this assumes only one menu per editor. So for example you would spend your type to search key on Add menu in the 3D View context, but the 4.0 idea is that all menus should be searchable.
Pablo Vazquez approved these changes 2023-10-11 11:44:17 +02:00
Pablo Vazquez left a comment
Member

Works as expected.

Thanks for tackling this one!

Works as expected. Thanks for tackling this one!
Harley Acheson added 2 commits 2023-10-11 18:37:02 +02:00
Dalai Felinto approved these changes 2023-10-12 15:50:41 +02:00
Dalai Felinto left a comment
Owner

It seems to be working as expected.

It seems to be working as expected.
Harley Acheson added 1 commit 2023-10-12 17:18:44 +02:00
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit b688414223 into blender-v4.0-release 2023-10-12 17:55:07 +02:00
Harley Acheson deleted branch CombinedMenuSearch 2023-10-12 17:55:09 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#113520
No description provided.