Keymap: New preference to open folders on single click in file browser

Introduce a new keymap preference to navigate into folders by clicking on them once instead of twice.
Makes browsing folders faster albeit non-standard, so keeping this off by default for now.

Does not affect Industry Compatible or other keymaps.

It is still the possible to right-click to open context menu, hold Ctrl or Shift to select multiple items:

{F10651030, size=full}

----

Keymap preference:

{F10652759, size=full}

Part of T91537

Reviewed By: fsiddi, campbellbarton

Differential Revision: https://developer.blender.org/D12667
This commit is contained in:
Pablo Vazquez 2021-09-28 15:13:23 +02:00
parent 1f4545dc9c
commit 901fa96b7f
Notes: blender-bot 2023-02-14 06:00:46 +01:00
Referenced by issue #92577, Blender 3.0 beta Cannot open folder shortcuts under Windows
Referenced by issue #92577, Blender 3.0 beta Cannot open folder shortcuts under Windows
Referenced by issue #92577, Blender 3.0 beta Cannot open folder shortcuts under Windows
Referenced by issue #92577, Blender 3.0 beta Cannot open folder shortcuts under Windows
2 changed files with 25 additions and 3 deletions

View File

@ -217,6 +217,15 @@ class Prefs(bpy.types.KeyConfigPreferences):
update=update_fn,
)
use_file_single_click: BoolProperty(
name="Open Folders on Single Click",
description=(
"Navigate into folders by clicking on them once instead of twice"
),
default=False,
update=update_fn,
)
def draw(self, layout):
from bpy import context
@ -273,6 +282,10 @@ class Prefs(bpy.types.KeyConfigPreferences):
sub.prop(self, "use_pie_click_drag")
sub.prop(self, "use_v3d_shade_ex_pie")
# File Browser settings.
col = layout.column()
col.label(text="File Browser")
col.row().prop(self, "use_file_single_click")
blender_default = bpy.utils.execfile(os.path.join(DIRNAME, "keymap_data", "blender_default.py"))
@ -312,6 +325,7 @@ def load():
),
use_alt_click_leader=kc_prefs.use_alt_click_leader,
use_pie_click_drag=kc_prefs.use_pie_click_drag,
use_file_single_click=kc_prefs.use_file_single_click,
),
)

View File

@ -66,6 +66,7 @@ class Params:
# Alt-MMB axis switching 'RELATIVE' or 'ABSOLUTE' axis switching.
"v3d_alt_mmb_drag_action",
"use_file_single_click",
# Convenience variables:
# (derived from other settings).
#
@ -106,6 +107,7 @@ class Params:
use_alt_tool_or_cursor=False,
use_alt_click_leader=False,
use_pie_click_drag=False,
use_file_single_click=False,
v3d_tilde_action='VIEW',
v3d_alt_mmb_drag_action='RELATIVE',
):
@ -190,6 +192,8 @@ class Params:
self.use_alt_click_leader = use_alt_click_leader
self.use_pie_click_drag = use_pie_click_drag
self.use_file_single_click = use_file_single_click
# Convenience variables:
self.use_fallback_tool_rmb = self.use_fallback_tool if self.select_mouse == 'RIGHT' else False
self.select_mouse_value_fallback = 'CLICK' if self.use_fallback_tool_rmb else self.select_mouse_value
@ -2151,16 +2155,20 @@ def km_file_browser_main(params):
{"items": items},
)
if not params.use_file_single_click:
items.extend([
("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'},
{"properties": [("open", True), ("deselect_all", not params.legacy)]}),
])
items.extend([
("file.mouse_execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
# Both .execute and .select are needed here. The former only works if
# there's a file operator (i.e. not in regular editor mode) but is
# needed to load files. The latter makes selection work if there's no
# operator (i.e. in regular editor mode).
("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'},
{"properties": [("open", True), ("deselect_all", not params.legacy)]}),
("file.select", {"type": 'LEFTMOUSE', "value": 'PRESS'},
{"properties": [("open", False), ("deselect_all", not params.legacy)]}),
{"properties": [("open", params.use_file_single_click), ("deselect_all", not params.legacy)]}),
("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
{"properties": [("extend", True), ("open", False)]}),
("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},