[Bf-blender-cvs] [71fd7e610a6] blender2.8: Keymaps: minor code refactor after adding tools to default preset.

Brecht Van Lommel noreply at git.blender.org
Thu Nov 15 12:50:40 CET 2018


Commit: 71fd7e610a6e4c6fabc9b8a12e5f56b698a542ae
Author: Brecht Van Lommel
Date:   Thu Nov 15 11:45:25 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB71fd7e610a6e4c6fabc9b8a12e5f56b698a542ae

Keymaps: minor code refactor after adding tools to default preset.

===================================================================

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	source/blender/windowmanager/intern/wm_keymap.c

===================================================================

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 5aa7a1c8793..c7da63dd75d 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -29,6 +29,8 @@ class KeymapParams:
         "select_click",
         "action_mouse",
         "action_tweak",
+        "tool_mouse",
+        "tool_tweak",
         "context_menu_event",
         "cursor_set_event",
     )
@@ -47,6 +49,8 @@ class KeymapParams:
             self.select_click = 'CLICK'
             self.action_mouse = 'RIGHTMOUSE'
             self.action_tweak = 'EVT_TWEAK_R'
+            self.tool_mouse = 'RIGHTMOUSE'
+            self.tool_tweak = 'EVT_TWEAK_R'
             self.context_menu_event = {"type": 'RIGHTMOUSE', "value": 'PRESS'}
             self.cursor_set_event = {"type": 'RIGHTMOUSE', "value": 'PRESS', "ctrl": True}
         elif select_mode == 'RIGHT':
@@ -56,6 +60,8 @@ class KeymapParams:
             self.select_click = 'PRESS'
             self.action_mouse = 'LEFTMOUSE'
             self.action_tweak = 'EVT_TWEAK_L'
+            self.tool_mouse = 'LEFTMOUSE'
+            self.tool_tweak = 'EVT_TWEAK_L'
             self.context_menu_event = {"type": 'W', "value": 'PRESS'}
             self.cursor_set_event = {"type": 'LEFTMOUSE', "value": 'PRESS'}
         else:
@@ -65,6 +71,8 @@ class KeymapParams:
             self.select_click = 'PRESS'
             self.action_mouse = 'ACTIONMOUSE'
             self.action_tweak = 'EVT_TWEAK_A'
+            self.tool_mouse = 'ACTIONMOUSE'
+            self.tool_tweak = 'EVT_TWEAK_A'
             self.context_menu_event = {"type": 'W', "value": 'PRESS'}
             self.cursor_set_event = {"type": self.action_mouse, "value": 'PRESS'}
 
@@ -4817,8 +4825,8 @@ def km_image_editor_tool_uv_cursor(params):
         "Image Editor Tool: Uv, Cursor",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("uv.cursor_set", {"type": params.action_mouse, "value": 'PRESS'}, None),
-            ("transform.translate", {"type": params.action_tweak, "value": 'ANY'},
+            ("uv.cursor_set", {"type": params.tool_mouse, "value": 'PRESS'}, None),
+            ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("release_confirm", True), ("cursor_transform", True)]}),
         ),
         },
@@ -4830,8 +4838,8 @@ def km_image_editor_tool_uv_select_box(params):
         "Image Editor Tool: Uv, Select Box",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("uv.select_box", {"type": params.action_tweak, "value": 'ANY'}, None),
-            ("uv.select_box", {"type": params.action_tweak, "value": 'ANY', "ctrl": True},
+            ("uv.select_box", {"type": params.tool_tweak, "value": 'ANY'}, None),
+            ("uv.select_box", {"type": params.tool_tweak, "value": 'ANY', "ctrl": True},
              {"properties": [("deselect", True)]}),
         ),
         },
@@ -4843,9 +4851,9 @@ def km_image_editor_tool_uv_select_circle(params):
         "Image Editor Tool: Uv, Select Circle",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("uv.select_circle", {"type": params.action_mouse, "value": 'PRESS'},
+            ("uv.select_circle", {"type": params.tool_mouse, "value": 'PRESS'},
              {"properties": [("deselect", False)]}),
-            ("uv.select_circle", {"type": params.action_mouse, "value": 'PRESS', "ctrl": True},
+            ("uv.select_circle", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True},
              {"properties": [("deselect", True)]}),
         ),
         },
@@ -4857,7 +4865,7 @@ def km_image_editor_tool_uv_select_lasso(params):
         "Image Editor Tool: Uv, Select Lasso",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("uv.select_lasso", {"type": params.action_tweak, "value": 'ANY'},
+            ("uv.select_lasso", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("deselect", False)]}),
         ),
         },
@@ -4869,7 +4877,7 @@ def km_image_editor_tool_uv_annotate(params):
         "Image Editor Tool: Uv, Annotate",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("gpencil.annotate", {"type": params.action_mouse, "value": 'PRESS'},
+            ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'},
              {"properties": [("mode", 'DRAW'), ("wait_for_input", False)]}),
         ),
         },
@@ -4881,7 +4889,7 @@ def km_image_editor_tool_uv_annotate_line(params):
         "Image Editor Tool: Uv, Annotate Line",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("gpencil.annotate", {"type": params.action_tweak, "value": 'ANY'},
+            ("gpencil.annotate", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("mode", 'DRAW_STRAIGHT'), ("wait_for_input", False)]}),
         ),
         },
@@ -4893,7 +4901,7 @@ def km_image_editor_tool_uv_annotate_polygon(params):
         "Image Editor Tool: Uv, Annotate Polygon",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("gpencil.annotate", {"type": params.action_mouse, "value": 'PRESS'},
+            ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'},
              {"properties": [("mode", 'DRAW_POLY'), ("wait_for_input", False)]}),
         ),
         },
@@ -4905,7 +4913,7 @@ def km_image_editor_tool_uv_annotate_eraser(params):
         "Image Editor Tool: Uv, Annotate Eraser",
         {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
         {"items": (
-            ("gpencil.annotate", {"type": params.action_mouse, "value": 'PRESS'},
+            ("gpencil.annotate", {"type": params.tool_mouse, "value": 'PRESS'},
              {"properties": [("mode", 'ERASER'), ("wait_for_input", False)]}),
         ),
         },
@@ -4917,8 +4925,8 @@ def km_3d_view_tool_object_cursor(params):
         "3D View Tool: Object, Cursor",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": (
-            ("view3d.cursor3d", {"type": params.action_mouse, "value": 'PRESS'}, None),
-            ("transform.translate", {"type": params.action_tweak, "value": 'ANY'},
+            ("view3d.cursor3d", {"type": params.tool_mouse, "value": 'PRESS'}, None),
+            ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("release_confirm", True), ("cursor_transform", True)]}),
         ),
         },
@@ -4929,7 +4937,7 @@ def km_3d_view_tool_object_select_box(params):
     return (
         "3D View Tool: Object, Select Box",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
-        {"items": _template_items_tool_select_actions("view3d.select_box", type=params.action_tweak, value='ANY')},
+        {"items": _template_items_tool_select_actions("view3d.select_box", type=params.tool_tweak, value='ANY')},
     )
 
 
@@ -4938,9 +4946,9 @@ def km_3d_view_tool_object_select_circle(params):
         "3D View Tool: Object, Select Circle",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": (
-            ("view3d.select_circle", {"type": params.action_mouse, "value": 'PRESS'},
+            ("view3d.select_circle", {"type": params.tool_mouse, "value": 'PRESS'},
              {"properties": [("deselect", False)]}),
-            ("view3d.select_circle", {"type": params.action_mouse, "value": 'PRESS', "ctrl": True},
+            ("view3d.select_circle", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True},
              {"properties": [("deselect", True)]}),
         ),
         },
@@ -4951,7 +4959,7 @@ def km_3d_view_tool_object_select_lasso(params):
     return (
         "3D View Tool: Object, Select Lasso",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
-        {"items": _template_items_tool_select_actions("view3d.select_lasso", type=params.action_tweak, value='ANY')},
+        {"items": _template_items_tool_select_actions("view3d.select_lasso", type=params.tool_tweak, value='ANY')},
     )
 
 
@@ -4960,7 +4968,7 @@ def km_3d_view_tool_object_transform(params):
         "3D View Tool: Object, Transform",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": (
-            ("transform.from_gizmo", {"type": params.action_tweak, "value": 'ANY'}, None),
+            ("transform.from_gizmo", {"type": params.tool_tweak, "value": 'ANY'}, None),
         ),
         },
     )
@@ -4971,7 +4979,7 @@ def km_3d_view_tool_object_move(params):
         "3D View Tool: Object, Move",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": (
-            ("transform.translate", {"type": params.action_tweak, "value": 'ANY'},
+            ("transform.translate", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("release_confirm", True)]}),
         ),
         },
@@ -4983,7 +4991,7 @@ def km_3d_view_tool_object_rotate(params):
         "3D View Tool: Object, Rotate",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": (
-            ("transform.rotate", {"type": params.action_tweak, "value": 'ANY'},
+            ("transform.rotate", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("release_confirm", True)]}),
         ),
         },
@@ -4995,7 +5003,7 @@ def km_3d_view_tool_object_scale(params):
         "3D View Tool: Object, Scale",
         {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
         {"items": (
-            ("transform.resize", {"type": params.action_tweak, "value": 'ANY'},
+            ("transform.resize", {"type": params.tool_tweak, "value": 'ANY'},
              {"properties": [("release_confirm", True)]}),
         ),
         },
@@ -5007,7 +5015,7 @@ def km_3d_view_tool_object_annotate(params):
         "3D View Tool: Object, Annotate",
         {"space_ty

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list