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).
This commit is contained in:
parent
c57951d903
commit
0cac506f6e
|
@ -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,
|
||||
),
|
||||
)
|
||||
|
|
|
@ -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)]}),
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue