2018-11-08 04:59:51 +00:00
|
|
|
import os
|
2018-11-15 21:28:58 +00:00
|
|
|
import bpy
|
2018-11-18 19:14:20 +00:00
|
|
|
from bpy.props import (
|
|
|
|
EnumProperty,
|
|
|
|
)
|
|
|
|
|
2018-11-19 23:56:50 +00:00
|
|
|
dirname, filename = os.path.split(__file__)
|
|
|
|
idname = os.path.splitext(filename)[0]
|
2018-11-18 19:14:20 +00:00
|
|
|
|
2018-11-18 20:04:24 +00:00
|
|
|
def update_fn(_self, _context):
|
|
|
|
load()
|
2018-11-18 19:14:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Prefs(bpy.types.KeyConfigPreferences):
|
|
|
|
bl_idname = idname
|
2018-11-15 21:28:58 +00:00
|
|
|
|
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. "
|
|
|
|
"Standard behavior that works well for all input devices"),
|
|
|
|
('RIGHT', "Right",
|
|
|
|
"Use right mouse button for selection."
|
|
|
|
"For efficiently working with keyboard and mouse"),
|
2018-11-18 19:14:20 +00:00
|
|
|
),
|
|
|
|
description=(
|
|
|
|
"Mouse button used for selection"
|
|
|
|
),
|
|
|
|
default='RIGHT',
|
2018-11-18 20:04:24 +00:00
|
|
|
update=update_fn,
|
2018-11-18 19:14:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def draw(self, layout):
|
2018-11-19 22:15:53 +00:00
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
2018-11-18 19:14:20 +00:00
|
|
|
col.label(text="Select With:")
|
|
|
|
col.row().prop(self, "select_mouse", expand=True)
|
2018-11-19 22:15:53 +00:00
|
|
|
split.column()
|
|
|
|
|
2018-11-15 21:28:58 +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-18 19:14:20 +00:00
|
|
|
|
2018-11-18 20:04:24 +00:00
|
|
|
def load():
|
2018-11-19 23:56:50 +00:00
|
|
|
from bl_keymap_utils.io import keyconfig_init_from_data
|
|
|
|
|
2018-11-18 19:14:20 +00:00
|
|
|
kc = bpy.context.window_manager.keyconfigs.new(idname)
|
|
|
|
kc_prefs = kc.preferences
|
|
|
|
|
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,
|
|
|
|
legacy=True,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
keyconfig_init_from_data(kc, keyconfig_data)
|
2018-07-07 17:50:37 +00:00
|
|
|
|
2018-11-16 04:00:27 +00:00
|
|
|
|
2018-07-07 17:50:37 +00:00
|
|
|
if __name__ == "__main__":
|
2018-11-18 19:14:20 +00:00
|
|
|
bpy.utils.register_class(Prefs)
|
2018-11-18 20:04:24 +00:00
|
|
|
load()
|