2018-11-08 04:59:51 +00:00
|
|
|
import os
|
2018-11-15 21:28:58 +00:00
|
|
|
import bpy
|
2018-11-18 01:41:05 +00:00
|
|
|
from bpy.props import (
|
|
|
|
BoolProperty,
|
2018-11-18 02:22:58 +00:00
|
|
|
EnumProperty,
|
2018-11-18 01:41:05 +00:00
|
|
|
)
|
2018-11-15 21:28:58 +00:00
|
|
|
|
2018-11-19 23:56:50 +00:00
|
|
|
dirname, filename = os.path.split(__file__)
|
|
|
|
idname = os.path.splitext(filename)[0]
|
2018-11-18 01:41:05 +00:00
|
|
|
|
2018-11-18 20:04:24 +00:00
|
|
|
def update_fn(_self, _context):
|
|
|
|
load()
|
2018-11-18 01:41:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Prefs(bpy.types.KeyConfigPreferences):
|
|
|
|
bl_idname = idname
|
|
|
|
|
2018-11-18 19:14:20 +00:00
|
|
|
select_mouse: EnumProperty(
|
2018-11-18 20:06:38 +00:00
|
|
|
name="Select Mouse",
|
2018-11-18 19:14:20 +00:00
|
|
|
items=(
|
2018-11-27 02:14:09 +00:00
|
|
|
('LEFT', "Left",
|
|
|
|
"Use left mouse button for selection. "
|
2018-11-27 15:09:02 +00:00
|
|
|
"The standard behavior that works well for mouse, trackpad and tablet devices"),
|
2018-11-27 02:14:09 +00:00
|
|
|
('RIGHT', "Right",
|
2018-11-27 15:09:02 +00:00
|
|
|
"Use right mouse button for selection, and left mouse button for actions. "
|
|
|
|
"This works well primarily for keyboard and mouse devices"),
|
2018-11-18 19:14:20 +00:00
|
|
|
),
|
|
|
|
description=(
|
|
|
|
"Mouse button used for selection"
|
|
|
|
),
|
2018-11-27 15:09:02 +00:00
|
|
|
default='LEFT',
|
2018-11-18 20:04:24 +00:00
|
|
|
update=update_fn,
|
2018-11-18 19:14:20 +00:00
|
|
|
)
|
2018-11-18 02:22:58 +00:00
|
|
|
spacebar_action: EnumProperty(
|
|
|
|
name="Spacebar",
|
|
|
|
items=(
|
2018-11-27 19:57:25 +00:00
|
|
|
('PLAY', "Play",
|
|
|
|
"Toggle animation playback "
|
|
|
|
"('Shift-Space' for Tools)",
|
|
|
|
1),
|
|
|
|
('TOOL', "Tools",
|
2018-11-18 02:22:58 +00:00
|
|
|
"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"
|
2018-11-27 19:57:25 +00:00
|
|
|
"For Play use 'Shift-Space'",
|
|
|
|
0),
|
|
|
|
('SEARCH', "Search",
|
|
|
|
"Open the operator search popup",
|
|
|
|
2),
|
2018-11-18 02:22:58 +00:00
|
|
|
),
|
|
|
|
description=(
|
2018-11-27 19:57:25 +00:00
|
|
|
"Action when 'Space' is pressed"
|
2018-11-18 02:22:58 +00:00
|
|
|
),
|
2018-11-27 19:57:25 +00:00
|
|
|
default='PLAY',
|
2018-11-18 20:04:24 +00:00
|
|
|
update=update_fn,
|
2018-11-18 02:22:58 +00:00
|
|
|
)
|
2018-11-18 01:41:05 +00:00
|
|
|
use_select_all_toggle: BoolProperty(
|
|
|
|
name="Select All Toggles",
|
|
|
|
description=(
|
2018-11-18 20:04:24 +00:00
|
|
|
"Causes select-all ('A' key) to de-select in the case a selection exists"
|
2018-11-18 01:41:05 +00:00
|
|
|
),
|
|
|
|
default=False,
|
2018-11-18 20:04:24 +00:00
|
|
|
update=update_fn,
|
2018-11-18 01:41:05 +00:00
|
|
|
)
|
|
|
|
|
2018-11-24 00:24:34 +00:00
|
|
|
# 3D View
|
2018-11-21 21:12:39 +00:00
|
|
|
use_v3d_tab_menu: BoolProperty(
|
|
|
|
name="Tab for Pie Menu",
|
|
|
|
description=(
|
|
|
|
"Causes tab to open pie menu (swaps 'Tab' / 'Ctrl-Tab')"
|
|
|
|
),
|
|
|
|
default=False,
|
|
|
|
update=update_fn,
|
|
|
|
)
|
2018-11-24 00:24:34 +00:00
|
|
|
use_v3d_shade_ex_pie: BoolProperty(
|
|
|
|
name="Extra Shading Pie Menu Items",
|
|
|
|
description=(
|
|
|
|
"Show additional options in the shading menu ('Z')"
|
|
|
|
),
|
|
|
|
default=False,
|
|
|
|
update=update_fn,
|
|
|
|
)
|
2019-02-13 22:38:05 +00:00
|
|
|
# Developer note, this is an experemental option.
|
|
|
|
use_pie_click_drag: BoolProperty(
|
|
|
|
name="Pie Menu on Drag",
|
|
|
|
description=(
|
|
|
|
"Activate some pie menus on drag,\n"
|
|
|
|
"allowing the tapping the same key to have a secondary action.\n"
|
|
|
|
"\n"
|
2019-02-27 14:02:14 +00:00
|
|
|
"\u2022 Tapping Tab in the 3D view toggles edit-mode, drag for mode menu.\n"
|
|
|
|
"\u2022 Tapping Z in the 3D view toggles wireframe, drag for draw modes.\n"
|
|
|
|
"\u2022 Tapping Tilde in the 3D view for first person navigation, drag for view axes"
|
2019-02-13 22:38:05 +00:00
|
|
|
),
|
|
|
|
default=False,
|
|
|
|
update=update_fn,
|
|
|
|
)
|
2018-11-21 21:12:39 +00:00
|
|
|
|
2018-11-18 01:41:05 +00:00
|
|
|
def draw(self, layout):
|
2018-11-19 22:15:53 +00:00
|
|
|
split = layout.split()
|
|
|
|
col = split.column(align=True)
|
2018-11-18 19:14:20 +00:00
|
|
|
col.label(text="Select With:")
|
|
|
|
col.row().prop(self, "select_mouse", expand=True)
|
2018-11-21 21:12:39 +00:00
|
|
|
col.prop(self, "use_select_all_toggle")
|
2018-11-18 19:14:20 +00:00
|
|
|
|
2018-11-19 22:15:53 +00:00
|
|
|
col = split.column(align=True)
|
2018-11-18 02:22:58 +00:00
|
|
|
col.label(text="Spacebar Action:")
|
|
|
|
col.row().prop(self, "spacebar_action", expand=True)
|
2018-11-18 19:14:20 +00:00
|
|
|
|
2018-11-24 00:24:34 +00:00
|
|
|
layout.label(text="3D View:")
|
2018-11-21 21:12:39 +00:00
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
|
|
col.prop(self, "use_v3d_tab_menu")
|
2019-02-13 22:38:05 +00:00
|
|
|
col.prop(self, "use_pie_click_drag")
|
2018-11-24 00:24:34 +00:00
|
|
|
col = split.column()
|
|
|
|
col.prop(self, "use_v3d_shade_ex_pie")
|
2018-11-18 01:41:05 +00:00
|
|
|
|
|
|
|
|
2018-11-19 23:56:50 +00:00
|
|
|
blender_default = bpy.utils.execfile(os.path.join(dirname, "keymap_data", "blender_default.py"))
|
2018-11-08 04:59:51 +00:00
|
|
|
|
|
|
|
|
2018-11-18 20:04:24 +00:00
|
|
|
def load():
|
2018-12-05 23:02:25 +00:00
|
|
|
from bpy import context
|
2018-11-19 23:56:50 +00:00
|
|
|
from bl_keymap_utils.io import keyconfig_init_from_data
|
|
|
|
|
2018-12-21 01:47:44 +00:00
|
|
|
prefs = context.preferences
|
2018-12-05 23:02:25 +00:00
|
|
|
kc = context.window_manager.keyconfigs.new(idname)
|
2018-11-18 01:41:05 +00:00
|
|
|
kc_prefs = kc.preferences
|
2018-11-16 04:00:27 +00:00
|
|
|
|
2018-11-18 20:04:24 +00:00
|
|
|
keyconfig_data = blender_default.generate_keymaps(
|
|
|
|
blender_default.Params(
|
2018-11-18 19:14:20 +00:00
|
|
|
select_mouse=kc_prefs.select_mouse,
|
2018-12-05 23:02:25 +00:00
|
|
|
use_mouse_emulate_3_button=prefs.inputs.use_mouse_emulate_3_button,
|
2018-11-18 02:22:58 +00:00
|
|
|
spacebar_action=kc_prefs.spacebar_action,
|
2018-11-18 01:41:05 +00:00
|
|
|
use_select_all_toggle=kc_prefs.use_select_all_toggle,
|
2018-11-21 21:12:39 +00:00
|
|
|
use_v3d_tab_menu=kc_prefs.use_v3d_tab_menu,
|
2018-11-24 00:24:34 +00:00
|
|
|
use_v3d_shade_ex_pie=kc_prefs.use_v3d_shade_ex_pie,
|
2019-02-13 22:38:05 +00:00
|
|
|
use_pie_click_drag=kc_prefs.use_pie_click_drag,
|
2018-11-18 01:41:05 +00:00
|
|
|
),
|
|
|
|
)
|
|
|
|
keyconfig_init_from_data(kc, keyconfig_data)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
bpy.utils.register_class(Prefs)
|
2018-11-18 20:04:24 +00:00
|
|
|
load()
|