Fix T59991: duplicate entries for node select operators in keymap.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 31 Dec 2018 13:11:42 +0000 (14:11 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 31 Dec 2018 13:11:42 +0000 (14:11 +0100)
Ref D4055.

release/scripts/presets/keyconfig/keymap_data/blender_default.py

index f7cd092..e8f21fb 100644 (file)
@@ -1513,39 +1513,34 @@ def km_node_editor(params):
         {"items": items},
     )
 
+    def node_select_ops(select_mouse):
+        return [
+            ("node.select", {"type": select_mouse, "value": 'PRESS'},
+             {"properties": [("extend", False)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "ctrl": True},
+             {"properties": [("extend", False)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "alt": True},
+             {"properties": [("extend", False)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "ctrl": True, "alt": True},
+             {"properties": [("extend", False)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True},
+             {"properties": [("extend", True)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True, "ctrl": True},
+             {"properties": [("extend", True)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True, "alt": True},
+             {"properties": [("extend", True)]}),
+            ("node.select", {"type": select_mouse, "value": 'PRESS', "shift": True, "ctrl": True, "alt": True},
+             {"properties": [("extend", True)]}),
+        ]
+
+    # Allow node selection with both for RMB select
+    if params.select_mouse == 'RIGHTMOUSE':
+        items.extend(node_select_ops('LEFTMOUSE'))
+        items.extend(node_select_ops('RIGHTMOUSE'))
+    else:
+        items.extend(node_select_ops('LEFTMOUSE'))
+
     items.extend([
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS'},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS'},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "alt": True},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True, "alt": True},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": True},
-         {"properties": [("extend", False)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True, "ctrl": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "alt": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True, "alt": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True},
-         {"properties": [("extend", True)]}),
-        ("node.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True, "ctrl": True, "alt": True},
-         {"properties": [("extend", True)]}),
         ("node.select_box", {"type": params.select_tweak, "value": 'ANY'},
          {"properties": [("tweak", True)]}),
         ("node.select_lasso", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True, "alt": True},