UI: Right click for asset/file browser context menu with right click select

When right click selection is used, the file and asset browser use "W"
to spawn the context menu. That may be unexpected for many users, even
when using right click selection, see #159567. The Outliner and UI
elements like regular buttons also spawn the context menu on right
click.

This adds right clicking for the context menu in both the asset and the
file browser, *in addition to the "W"-key*.

Pull Request: https://projects.blender.org/blender/blender/pulls/159629
This commit is contained in:
Julian Eisel 2026-06-05 14:34:08 +02:00 • committed by Julian Eisel
parent 2a05b38ca9
commit c8b32bd722

View file

@ -2522,13 +2522,18 @@ def km_file_browser(params):
# Select file under cursor before spawning the context menu.
("file.select", {"type": 'RIGHTMOUSE', "value": 'PRESS'},
{"properties": [
("open", False),
("only_activate_if_selected", params.select_mouse == 'LEFTMOUSE'), ("pass_through", True),
]}),
{"properties": [("open", False), ("only_activate_if_selected", True), ("pass_through", True),]}),
*_template_items_context_menu("FILEBROWSER_MT_context_menu", params.context_menu_event),
])
if params.select_mouse == 'RIGHTMOUSE':
items.extend([
# Also add context menu on right mouse click when right click selection is active. Many
# users expect this and it's consistent with the Outliner.
*_template_items_context_menu("FILEBROWSER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
*_template_items_context_menu("ASSETBROWSER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
])
return keymap