2018-11-08 15:59:51 +11:00
|
|
|
import os
|
2018-11-16 08:28:58 +11:00
|
|
|
import bpy
|
2018-11-19 06:14:20 +11:00
|
|
|
from bpy.props import (
|
|
|
|
EnumProperty,
|
|
|
|
)
|
|
|
|
|
2019-09-15 05:13:22 +10:00
|
|
|
DIRNAME, FILENAME = os.path.split(__file__)
|
|
|
|
IDNAME = os.path.splitext(FILENAME)[0]
|
2018-11-19 06:14:20 +11:00
|
|
|
|
2018-11-19 07:04:24 +11:00
|
|
|
def update_fn(_self, _context):
|
|
|
|
load()
|
2018-11-19 06:14:20 +11:00
|
|
|
|
|
|
|
|
|
|
|
class Prefs(bpy.types.KeyConfigPreferences):
|
2019-09-15 05:13:22 +10:00
|
|
|
bl_idname = IDNAME
|
2018-11-16 08:28:58 +11:00
|
|
|
|
2018-11-19 06:14:20 +11:00
|
|
|
select_mouse: EnumProperty(
|
2018-11-19 07:06:38 +11:00
|
|
|
name="Select Mouse",
|
2018-11-19 06:14:20 +11:00
|
|
|
items=(
|
2018-11-27 13:14:09 +11:00
|
|
|
('LEFT', "Left",
|
|
|
|
"Use left mouse button for selection. "
|
2018-11-27 16:09:02 +01:00
|
|
|
"The standard behavior that works well for mouse, trackpad and tablet devices"),
|
2018-11-27 13:14:09 +11:00
|
|
|
('RIGHT', "Right",
|
2018-11-27 16:09:02 +01:00
|
|
|
"Use right mouse button for selection, and left mouse button for actions. "
|
|
|
|
"This works well primarily for keyboard and mouse devices"),
|
2018-11-19 06:14:20 +11:00
|
|
|
),
|
|
|
|
description=(
|
|
|
|
"Mouse button used for selection"
|
|
|
|
),
|
|
|
|
default='RIGHT',
|
2018-11-19 07:04:24 +11:00
|
|
|
update=update_fn,
|
2018-11-19 06:14:20 +11:00
|
|
|
)
|
|
|
|
|
|
|
|
def draw(self, layout):
|
2018-11-20 09:15:53 +11:00
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
2018-11-19 06:14:20 +11:00
|
|
|
col.label(text="Select With:")
|
|
|
|
col.row().prop(self, "select_mouse", expand=True)
|
2018-11-20 09:15:53 +11:00
|
|
|
split.column()
|
|
|
|
|
2018-11-16 08:28:58 +11:00
|
|
|
|
2019-09-15 05:13:22 +10:00
|
|
|
blender_default = bpy.utils.execfile(os.path.join(DIRNAME, "keymap_data", "blender_default.py"))
|
2018-11-19 06:14:20 +11:00
|
|
|
|
2018-11-19 07:04:24 +11:00
|
|
|
def load():
|
2019-05-09 16:09:25 +10:00
|
|
|
from sys import platform
|
2018-12-06 10:02:25 +11:00
|
|
|
from bpy import context
|
2018-11-20 10:56:50 +11:00
|
|
|
from bl_keymap_utils.io import keyconfig_init_from_data
|
|
|
|
|
2018-12-21 12:47:44 +11:00
|
|
|
prefs = context.preferences
|
2019-09-15 05:13:22 +10:00
|
|
|
kc = context.window_manager.keyconfigs.new(IDNAME)
|
2018-11-19 06:14:20 +11:00
|
|
|
kc_prefs = kc.preferences
|
|
|
|
|
2018-11-19 07:04:24 +11:00
|
|
|
keyconfig_data = blender_default.generate_keymaps(
|
|
|
|
blender_default.Params(
|
2018-11-19 06:14:20 +11:00
|
|
|
select_mouse=kc_prefs.select_mouse,
|
2019-10-03 00:20:58 +10:00
|
|
|
use_mouse_emulate_3_button=(
|
|
|
|
prefs.inputs.use_mouse_emulate_3_button and
|
|
|
|
prefs.inputs.mouse_emulate_3_button_modifier == 'ALT'
|
|
|
|
),
|
2018-12-03 00:38:40 +01:00
|
|
|
spacebar_action='SEARCH',
|
|
|
|
use_select_all_toggle=True,
|
2019-06-07 11:45:50 +10:00
|
|
|
use_gizmo_drag=False,
|
2018-11-19 06:14:20 +11:00
|
|
|
legacy=True,
|
|
|
|
),
|
|
|
|
)
|
2019-05-09 16:09:25 +10:00
|
|
|
|
|
|
|
if platform == 'darwin':
|
|
|
|
from bl_keymap_utils.platform_helpers import keyconfig_data_oskey_from_ctrl_for_macos
|
|
|
|
keyconfig_data = keyconfig_data_oskey_from_ctrl_for_macos(keyconfig_data)
|
|
|
|
|
|
|
|
|
2018-11-19 06:14:20 +11:00
|
|
|
keyconfig_init_from_data(kc, keyconfig_data)
|
2018-07-07 19:50:37 +02:00
|
|
|
|
2018-11-16 15:00:27 +11:00
|
|
|
|
2018-07-07 19:50:37 +02:00
|
|
|
if __name__ == "__main__":
|
2018-11-19 06:14:20 +11:00
|
|
|
bpy.utils.register_class(Prefs)
|
2018-11-19 07:04:24 +11:00
|
|
|
load()
|