[Bf-blender-cvs] [79bd553f062] blender-v2.82-release: Industry Compatible Keymap: use MMB to access the active tool
Campbell Barton
noreply at git.blender.org
Tue Jan 21 13:54:51 CET 2020
Commit: 79bd553f06283d7e30c76e3851c2444fa9a73ffb
Author: Campbell Barton
Date: Tue Jan 21 23:50:24 2020 +1100
Branches: blender-v2.82-release
https://developer.blender.org/rB79bd553f06283d7e30c76e3851c2444fa9a73ffb
Industry Compatible Keymap: use MMB to access the active tool
Fallback tools are used on LMB, MMB accessed the active tool.
===================================================================
M release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 01db6994f37..ceca4687443 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3669,7 +3669,7 @@ def km_generic_gizmo_maybe_drag(params):
# ------------------------------------------------------------------------------
# Full Configuration
-def generate_keymaps(params=None):
+def generate_keymaps_impl(params=None):
if params is None:
params = Params()
return [
@@ -3768,3 +3768,50 @@ def generate_keymaps(params=None):
km_3d_view_tool_scale(params),
]
+
+
+def keymap_transform_tool_mmb(keymap):
+ import re
+ # Any tool besides fallback tools.
+ re_fallback_tool = re.compile(
+ r".*\bTool:\s(?!"
+ r".*\bSelect Box$|"
+ r".*\bSelect Circle$|"
+ r".*\bSelect Lasso$|"
+ r".*\bTweak$)",
+ )
+ for km_name, km_args, km_content in keymap:
+ if re_fallback_tool.match(km_name):
+ km_items = km_content["items"]
+ km_items_new = []
+ for kmi in km_items:
+ ty = kmi[1]["type"]
+ if ty == 'LEFTMOUSE':
+ kmi = (kmi[0], kmi[1].copy(), kmi[2])
+ kmi[1]["type"] = 'MIDDLEMOUSE'
+ km_items_new.append(kmi)
+ elif ty == 'EVT_TWEAK_L':
+ kmi = (kmi[0], kmi[1].copy(), kmi[2])
+ kmi[1]["type"] = 'EVT_TWEAK_M'
+ km_items_new.append(kmi)
+ km_items.extend(km_items_new)
+
+
+def generate_keymaps(params=None):
+ import os
+ from bpy.utils import execfile
+ keymap = generate_keymaps_impl(params)
+
+ # Combine the key-map to support manipulating it, so we don't need to manually
+ # define key-map here just to manipulate them.
+ blender_default = execfile(
+ os.path.join(os.path.dirname(__file__), "blender_default.py"),
+ ).generate_keymaps()
+
+ keymap_existing_names = {km[0] for km in keymap}
+ keymap.extend([km for km in blender_default if km[0] not in keymap_existing_names])
+
+ # Manipulate the key-map.
+ keymap_transform_tool_mmb(keymap)
+
+ return keymap
More information about the Bf-blender-cvs
mailing list