[Bf-blender-cvs] [0cac506f6ee] blender2.8: Keymap: preference to swap space/shift-space keys
Campbell Barton
noreply at git.blender.org
Sun Nov 18 03:44:02 CET 2018
Commit: 0cac506f6ee03cdf957aa6c0f361d3416086fa20
Author: Campbell Barton
Date: Sun Nov 18 13:22:58 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB0cac506f6ee03cdf957aa6c0f361d3416086fa20
Keymap: preference to swap space/shift-space keys
This option is for animators who may not use the tool-system much
(mostly staying in object/pose-mode with the transform-tool active).
===================================================================
M release/scripts/presets/keyconfig/blender.py
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
===================================================================
diff --git a/release/scripts/presets/keyconfig/blender.py b/release/scripts/presets/keyconfig/blender.py
index 1f589acf963..060eabe8275 100644
--- a/release/scripts/presets/keyconfig/blender.py
+++ b/release/scripts/presets/keyconfig/blender.py
@@ -2,6 +2,7 @@ import os
import bpy
from bpy.props import (
BoolProperty,
+ EnumProperty,
)
userpref = bpy.context.user_preferences
@@ -15,6 +16,25 @@ def update(_self, _context):
class Prefs(bpy.types.KeyConfigPreferences):
bl_idname = idname
+ spacebar_action: EnumProperty(
+ name="Spacebar",
+ items=(
+ ('TOOL', "Tool-Bar",
+ "Open the popup tool-bar\n"
+ "When 'Space' is held and used as a modifier:\n"
+ "\u2022 Pressing the tools binding key switches to it immediately.\n"
+ "\u2022 Dragging the cursor over a tool and releasing activates it (like a pie menu).\n"
+ ),
+ ('PLAY', "Playback",
+ "Toggle animation playback"
+ ),
+ ),
+ description=(
+ "Action when 'Space' is pressed ('Shift-Space' is used for the other action)"
+ ),
+ default='TOOL',
+ update=update,
+ )
use_select_all_toggle: BoolProperty(
name="Select All Toggles",
description=(
@@ -25,8 +45,10 @@ class Prefs(bpy.types.KeyConfigPreferences):
)
def draw(self, layout):
- row = layout.row()
- row.prop(self, "use_select_all_toggle")
+ col = layout.column(align=True)
+ col.label(text="Spacebar Action:")
+ col.row().prop(self, "spacebar_action", expand=True)
+ layout.prop(self, "use_select_all_toggle")
from bpy_extras.keyconfig_utils import (
@@ -43,6 +65,7 @@ def _load():
keyconfig_data = mod.generate_keymaps(
mod.KeymapParams(
select_mouse=userpref.inputs.select_mouse,
+ spacebar_action=kc_prefs.spacebar_action,
use_select_all_toggle=kc_prefs.use_select_all_toggle,
),
)
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 6c5c99702ba..9453c3ae134 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -35,6 +35,10 @@ class KeymapParams:
"cursor_set_event",
# User preferences.
+ #
+ # Swap 'Space/Shift-Space'.
+ "spacebar_action",
+ # Key toggles selection with 'A'.
"use_select_all_toggle",
)
@@ -46,6 +50,7 @@ class KeymapParams:
select_mouse='RIGHT',
# User preferences.
+ spacebar_action='TOOL',
use_select_all_toggle=False,
):
import platform
@@ -84,6 +89,7 @@ class KeymapParams:
self.cursor_set_event = {"type": 'RIGHTMOUSE', "value": 'PRESS', "shift": True}
# User preferences
+ self.spacebar_action = spacebar_action
self.use_select_all_toggle = use_select_all_toggle
@@ -276,9 +282,20 @@ def km_window(params):
("wm.doc_view_manual_ui_context", {"type": 'F1', "value": 'PRESS'}, None),
op_menu("TOPBAR_MT_file_specials", {"type": 'F2', "value": 'PRESS'}),
("wm.search_menu", {"type": 'F3', "value": 'PRESS'}, None),
- ("wm.toolbar", {"type": 'SPACE', "value": 'PRESS'}, None),
op_menu("TOPBAR_MT_window_specials", {"type": 'F4', "value": 'PRESS'}),
])
+
+ if params.spacebar_action == 'TOOL':
+ items.append(
+ ("wm.toolbar", {"type": 'SPACE', "value": 'PRESS'}, None),
+ )
+ elif params.spacebar_action == 'PLAY':
+ items.append(
+ ("wm.toolbar", {"type": 'SPACE', "value": 'PRESS', "shift": True}, None),
+ )
+ else:
+ assert(0)
+
else:
# Old shorctus
items.extend([
@@ -2581,8 +2598,18 @@ def km_frames(params):
if not params.legacy:
# New playback
+ if params.spacebar_action == 'TOOL':
+ items.append(
+ ("screen.animation_play", {"type": 'SPACE', "value": 'PRESS', "shift": True}, None),
+ )
+ elif params.spacebar_action == 'PLAY':
+ items.append(
+ ("screen.animation_play", {"type": 'SPACE', "value": 'PRESS'}, None),
+ )
+ else:
+ assert(0)
+
items.extend([
- ("screen.animation_play", {"type": 'SPACE', "value": 'PRESS', "shift": True}, None),
("screen.animation_play", {"type": 'SPACE', "value": 'PRESS', "shift": True, "ctrl": True},
{"properties": [("reverse", True)]}),
])
More information about the Bf-blender-cvs
mailing list