1
1

Tweak Tool: supports select & tweak on LMB (with RMB-select key-map)

Support for differentiating the tweak tool from the 3D cursor when
select is set to RMB.

This is currently an experimental preference:
Tweak Tool: Left Mouse Select & Drag

When enabled the tweak tool can now tweak the existing selection
without de-selecting first, a single click can be used to replace
the selection.
This matches selection in the graph & node editors.

This preferences is only available with "Developer Extras" enabled.

Ref T96544.
This commit is contained in:
2022-03-17 16:27:31 +11:00
parent 3017585ebf
commit bb735bd518
2 changed files with 39 additions and 0 deletions

View File

@@ -85,6 +85,18 @@ class Prefs(bpy.types.KeyConfigPreferences):
),
update=update_fn,
)
# Experimental: only show with developer extras, see: T96544.
use_tweak_tool_lmb_interaction: BoolProperty(
name="Tweak Tool: Left Mouse Select & Move",
description=(
"The tweak tool is activated immediately instead of placing the cursor. "
"This is an experimental preference and may be removed"
),
default=False,
update=update_fn,
)
use_alt_click_leader: BoolProperty(
name="Alt Click Tool Prompt",
description=(
@@ -236,6 +248,7 @@ class Prefs(bpy.types.KeyConfigPreferences):
prefs = context.preferences
show_developer_ui = prefs.view.show_developer_ui
is_select_left = (self.select_mouse == 'LEFT')
use_mouse_emulate_3_button = (
prefs.inputs.use_mouse_emulate_3_button and
@@ -270,6 +283,10 @@ class Prefs(bpy.types.KeyConfigPreferences):
row = sub.row()
row.prop(self, "use_select_all_toggle")
if show_developer_ui and (not is_select_left):
row = sub.row()
row.prop(self, "use_tweak_tool_lmb_interaction")
# 3DView settings.
col = layout.column()
col.label(text="3D View")
@@ -301,6 +318,7 @@ def load():
kc = context.window_manager.keyconfigs.new(IDNAME)
kc_prefs = kc.preferences
show_developer_ui = prefs.view.show_developer_ui
is_select_left = (kc_prefs.select_mouse == 'LEFT')
use_mouse_emulate_3_button = (
prefs.inputs.use_mouse_emulate_3_button and
@@ -322,6 +340,10 @@ def load():
use_gizmo_drag=(is_select_left and kc_prefs.gizmo_action == 'DRAG'),
use_fallback_tool=True,
use_fallback_tool_rmb=(False if is_select_left else kc_prefs.rmb_action == 'FALLBACK_TOOL'),
use_tweak_tool_lmb_interaction=(
False if is_select_left else
(show_developer_ui and kc_prefs.use_tweak_tool_lmb_interaction)
),
use_alt_tool_or_cursor=(
(not use_mouse_emulate_3_button) and
(kc_prefs.use_alt_tool if is_select_left else kc_prefs.use_alt_cursor)

View File

@@ -31,6 +31,7 @@ class Params:
"context_menu_event",
"cursor_set_event",
"cursor_tweak_event",
"use_tweak_tool_lmb_interaction",
"use_mouse_emulate_3_button",
# User preferences:
@@ -102,6 +103,7 @@ class Params:
use_gizmo_drag=True,
use_fallback_tool=False,
use_fallback_tool_rmb=False,
use_tweak_tool_lmb_interaction=False,
use_v3d_tab_menu=False,
use_v3d_shade_ex_pie=False,
use_v3d_mmb_pan=False,
@@ -129,6 +131,7 @@ class Params:
self.tool_maybe_tweak_value = 'PRESS'
else:
self.tool_maybe_tweak_value = 'CLICK_DRAG'
self.use_tweak_tool_lmb_interaction = use_tweak_tool_lmb_interaction
self.context_menu_event = {"type": 'W', "value": 'PRESS'}
@@ -150,6 +153,7 @@ class Params:
self.action_mouse = 'RIGHTMOUSE'
self.tool_mouse = 'LEFTMOUSE'
self.tool_maybe_tweak_value = 'CLICK_DRAG'
self.use_tweak_tool_lmb_interaction = False
if self.legacy:
self.context_menu_event = {"type": 'W', "value": 'PRESS'}
@@ -457,6 +461,19 @@ def _template_items_tool_select(params, operator, cursor_operator, fallback, *,
{"properties": [(extend, True)]}),
]
else:
# Experimental support for LMB interaction for the tweak tool.
if params.use_tweak_tool_lmb_interaction and not fallback:
return [
(operator, {"type": 'LEFTMOUSE', "value": 'PRESS'},
{"properties": [("deselect_all", True), ("select_passthrough", True)]}),
(operator, {"type": 'LEFTMOUSE', "value": 'CLICK'},
{"properties": [("deselect_all", True)]}),
(operator, {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
{"properties": [("deselect_all", False), ("toggle", True)]}),
("transform.translate", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG'},
{"properties": [("release_confirm", True)]}),
]
# For right mouse, set the cursor.
return [
(cursor_operator, {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),