[Bf-blender-cvs] [f5080c82dd9] master: Keymap: disable 'repeat' by default for keymap items

Campbell Barton noreply at git.blender.org
Thu Oct 22 03:30:40 CEST 2020


Commit: f5080c82dd915db6c7b9dd68a52aaaccf2600137
Author: Campbell Barton
Date:   Thu Oct 22 12:29:45 2020 +1100
Branches: master
https://developer.blender.org/rBf5080c82dd915db6c7b9dd68a52aaaccf2600137

Keymap: disable 'repeat' by default for keymap items

In practice, there are only a limited number of operations we need to
use repeat such as navigation, stepping operations that cycle states
and text input.

Now we don't need to disable repeat explicitly when a modal operator
uses checks for a key being held as was needed for 17cb2a6da0c88.

Repeat is now included in exported keymaps.

Use versioning so existing exported keymaps are loaded properly.

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

M	release/scripts/modules/bl_keymap_utils/io.py
M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M	source/blender/makesrna/intern/rna_wm_api.c

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

diff --git a/release/scripts/modules/bl_keymap_utils/io.py b/release/scripts/modules/bl_keymap_utils/io.py
index 96f45cd9875..e850661d6c6 100644
--- a/release/scripts/modules/bl_keymap_utils/io.py
+++ b/release/scripts/modules/bl_keymap_utils/io.py
@@ -73,6 +73,11 @@ def kmi_args_as_data(kmi):
     if kmi.key_modifier and kmi.key_modifier != 'NONE':
         s.append(f"\"key_modifier\": '{kmi.key_modifier}'")
 
+    if kmi.repeat:
+        if kmi.map_type == 'KEYBOARD':
+            if kmi.value in {'PRESS', 'ANY'}:
+                s.append("\"repeat\": True")
+
     return "{" + ", ".join(s) + "}"
 
 
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 7cf687cbaa2..cfed4955c99 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -394,7 +394,7 @@ def km_window(params):
             ("wm.window_new", {"type": 'W', "value": 'PRESS', "ctrl": True, "alt": True}, None),
             ("wm.window_fullscreen_toggle", {"type": 'F11', "value": 'PRESS', "alt": True}, None),
             ("wm.doc_view_manual_ui_context", {"type": 'F1', "value": 'PRESS', "alt": True}, None),
-            ("wm.search_menu", {"type": 'SPACE', "value": 'PRESS', "repeat": False}, None),
+            ("wm.search_menu", {"type": 'SPACE', "value": 'PRESS'}, None),
             ("wm.redraw_timer", {"type": 'T', "value": 'PRESS', "ctrl": True, "alt": True}, None),
             ("wm.debug_menu", {"type": 'D', "value": 'PRESS', "ctrl": True, "alt": True}, None),
         ])
@@ -470,11 +470,11 @@ def km_window(params):
             )
         elif params.spacebar_action == 'PLAY':
             items.append(
-                ("wm.toolbar", {"type": 'SPACE', "value": 'PRESS', "shift": True, "repeat": False}, None),
+                ("wm.toolbar", {"type": 'SPACE', "value": 'PRESS', "shift": True}, None),
             )
         elif params.spacebar_action == 'SEARCH':
             items.append(
-                ("wm.search_menu", {"type": 'SPACE', "value": 'PRESS', "repeat": False}, None),
+                ("wm.search_menu", {"type": 'SPACE', "value": 'PRESS'}, None),
             )
         else:
             assert False
@@ -506,14 +506,14 @@ def km_screen(params):
         # Quad view
         ("screen.region_quadview", {"type": 'Q', "value": 'PRESS', "ctrl": True, "alt": True}, None),
         # Repeat last
-        ("screen.repeat_last", {"type": 'R', "value": 'PRESS', "shift": True}, None),
+        ("screen.repeat_last", {"type": 'R', "value": 'PRESS', "shift": True, "repeat": True}, None),
         # Files
         ("file.execute", {"type": 'RET', "value": 'PRESS'}, None),
         ("file.execute", {"type": 'NUMPAD_ENTER', "value": 'PRESS'}, None),
         ("file.cancel", {"type": 'ESC', "value": 'PRESS'}, None),
         # Undo
-        ("ed.undo", {"type": 'Z', "value": 'PRESS', "ctrl": True}, None),
-        ("ed.redo", {"type": 'Z', "value": 'PRESS', "shift": True, "ctrl": True}, None),
+        ("ed.undo", {"type": 'Z', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
+        ("ed.redo", {"type": 'Z', "value": 'PRESS', "shift": True, "ctrl": True, "repeat": True}, None),
         # Render
         ("render.render", {"type": 'F12', "value": 'PRESS'},
          {"properties": [("use_viewport", True)]}),
@@ -526,8 +526,8 @@ def km_screen(params):
 
     if not params.legacy:
         items.extend([
-            ("screen.screen_full_area", {"type": 'SPACE', "value": 'PRESS', "ctrl": True, "repeat": False}, None),
-            ("screen.screen_full_area", {"type": 'SPACE', "value": 'PRESS', "ctrl": True, "alt": True, "repeat": False},
+            ("screen.screen_full_area", {"type": 'SPACE', "value": 'PRESS', "ctrl": True}, None),
+            ("screen.screen_full_area", {"type": 'SPACE', "value": 'PRESS', "ctrl": True, "alt": True},
              {"properties": [("use_hide_panels", True)]}),
             ("screen.redo_last", {"type": 'F9', "value": 'PRESS'}, None),
         ])
@@ -633,8 +633,8 @@ def km_view2d(_params):
         # Zoom with single step
         ("view2d.zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS'}, None),
         ("view2d.zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS'}, None),
-        ("view2d.zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, None),
-        ("view2d.zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS'}, None),
+        ("view2d.zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "repeat": True}, None),
+        ("view2d.zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "repeat": True}, None),
         ("view2d.zoom", {"type": 'TRACKPADPAN', "value": 'ANY', "ctrl": True}, None),
         ("view2d.smoothview", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
         # Scroll up/down, only when zoom is not available.
@@ -668,16 +668,16 @@ def km_view2d_buttons_list(_params):
         ("view2d.pan", {"type": 'TRACKPADPAN', "value": 'ANY'}, None),
         ("view2d.scroll_down", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS'}, None),
         ("view2d.scroll_up", {"type": 'WHEELUPMOUSE', "value": 'PRESS'}, None),
-        ("view2d.scroll_down", {"type": 'PAGE_DOWN', "value": 'PRESS'},
+        ("view2d.scroll_down", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True},
          {"properties": [("page", True)]}),
-        ("view2d.scroll_up", {"type": 'PAGE_UP', "value": 'PRESS'},
+        ("view2d.scroll_up", {"type": 'PAGE_UP', "value": 'PRESS', "repeat": True},
          {"properties": [("page", True)]}),
         # Zoom
         ("view2d.zoom", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "ctrl": True}, None),
         ("view2d.zoom", {"type": 'TRACKPADZOOM', "value": 'ANY'}, None),
         ("view2d.zoom", {"type": 'TRACKPADPAN', "value": 'ANY', "ctrl": True}, None),
-        ("view2d.zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, None),
-        ("view2d.zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS'}, None),
+        ("view2d.zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "repeat": True}, None),
+        ("view2d.zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "repeat": True}, None),
         ("view2d.reset", {"type": 'HOME', "value": 'PRESS'}, None),
     ])
 
@@ -789,17 +789,21 @@ def km_outliner(params):
          {"properties": [("tweak", True), ("mode", "ADD")]}),
         ("outliner.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True},
          {"properties": [("tweak", True), ("mode", "SUB")]}),
-        ("outliner.select_walk", {"type": 'UP_ARROW', "value": 'PRESS'}, {"properties": [("direction", 'UP')]}),
-        ("outliner.select_walk", {"type": 'UP_ARROW', "value": 'PRESS', "shift": True},
+        ("outliner.select_walk", {"type": 'UP_ARROW', "value": 'PRESS', "repeat": True},
+         {"properties": [("direction", 'UP')]}),
+        ("outliner.select_walk", {"type": 'UP_ARROW', "value": 'PRESS', "shift": True, "repeat": True},
          {"properties": [("direction", 'UP'), ("extend", True)]}),
-        ("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS'}, {"properties": [("direction", 'DOWN')]}),
-        ("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS', "shift": True},
+        ("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS', "repeat": True},
+         {"properties": [("direction", 'DOWN')]}),
+        ("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS', "shift": True, "repeat": True},
          {"properties": [("direction", 'DOWN'), ("extend", True)]}),
-        ("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS'}, {"properties": [("direction", 'LEFT')]}),
-        ("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS', "shift": True},
+        ("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS', "repeat": True},
+         {"properties": [("direction", 'LEFT')]}),
+        ("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS', "shift": True, "repeat": True},
          {"properties": [("direction", 'LEFT'), ("toggle_all", True)]}),
-        ("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS'}, {"properties": [("direction", 'RIGHT')]}),
-        ("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS', "shift": True},
+        ("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS', "repeat": True},
+         {"properties": [("direction", 'RIGHT')]}),
+        ("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS', "shift": True, "repeat": True},
          {"properties": [("direction", 'RIGHT'), ("toggle_all", True)]}),
         ("outliner.item_openclose", {"type": 'LEFTMOUSE', "value": 'CLICK'},
          {"properties": [("all", False)]}),
@@ -815,9 +819,9 @@ def km_outliner(params):
         ("outliner.show_hierarchy", {"type": 'HOME', "value": 'PRESS'}, None),
         ("outliner.show_active", {"type": 'PERIOD', "value": 'PRESS'}, None),
         ("outliner.show_active", {"type": 'NUMPAD_PERIOD', "value": 'PRESS'}, None),
-        ("outliner.scroll_page", {"type": 'PAGE_DOWN', "value": 'PRESS'},
+        ("outliner.scroll_page", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True},
          {"properties": [("up", False)]}),
-        ("outliner.scroll_page", {"type": 'PAGE_UP', "value": 'PRESS'},
+        ("outliner.scroll_page", {"type": 'PAGE_UP', "value": 'PRESS', "repeat": True},
          {"properties": [("up", True)]}),
         ("outliner.show_one_level", {"type": 'NUMPAD_PLUS', "value": 'PRESS'}, None),
         ("outliner.show_one_level", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
@@ -890,8 +894,8 @@ def km_uv_editor(params):
          {"properties": [("extend", True), ("deselect", False)]}),
         ("uv.select_linked_pick", {"type": 'L', "value": 'PRESS', "shift": True},
          {"properties": [("extend", False), ("deselect", True)]}),
-        ("uv.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True}, None),
-        ("uv.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True}, None),
+        ("uv.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctr

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list