diff options
Diffstat (limited to 'release/scripts/presets/keyconfig/Blender.py')
-rw-r--r-- | release/scripts/presets/keyconfig/Blender.py | 103 |
1 files changed, 78 insertions, 25 deletions
diff --git a/release/scripts/presets/keyconfig/Blender.py b/release/scripts/presets/keyconfig/Blender.py index 15cc6097979..1852e150589 100644 --- a/release/scripts/presets/keyconfig/Blender.py +++ b/release/scripts/presets/keyconfig/Blender.py @@ -8,6 +8,7 @@ from bpy.props import ( DIRNAME, FILENAME = os.path.split(__file__) IDNAME = os.path.splitext(FILENAME)[0] + def update_fn(_self, _context): load() @@ -54,12 +55,18 @@ class Prefs(bpy.types.KeyConfigPreferences): default='PLAY', update=update_fn, ) - use_key_activate_tools: BoolProperty( - name="Keys Activate Tools", + tool_key_mode: EnumProperty( + name="Tool Keys:", description=( - "Key shortcuts such as G, R, and S activate the tool instead of running it immediately" + "The method of keys to activate tools such as move, rotate & scale (G, R, S)" ), - default=False, + items=( + ('IMMEDIATE', "Immediate", + "Activate actions immediately"), + ('TOOL', "Active Tool", + "Activate the tool for editors that support tools"), + ), + default='IMMEDIATE', update=update_fn, ) @@ -85,14 +92,28 @@ class Prefs(bpy.types.KeyConfigPreferences): default=False, update=update_fn, ) + # NOTE: expose `use_alt_tool` and `use_alt_cursor` as two options in the UI + # as the tool-tips and titles are different enough depending on RMB/LMB select. use_alt_tool: BoolProperty( name="Alt Tool Access", description=( - "Hold Alt to use the active tool when the gizmo would normally be required" + "Hold Alt to use the active tool when the gizmo would normally be required\n" + "Incompatible with the input preference \"Emulate 3 Button Mouse\" when the \"Alt\" key is used" + ), + default=False, + update=update_fn, + ) + use_alt_cursor: BoolProperty( + name="Alt Cursor Access", + description=( + "Hold Alt-LMB to place the Cursor (instead of LMB), allows tools to activate on press instead of drag.\n" + "Incompatible with the input preference \"Emulate 3 Button Mouse\" when the \"Alt\" key is used" ), default=False, update=update_fn, ) + # end note. + use_select_all_toggle: BoolProperty( name="Select All Toggles", description=( @@ -196,39 +217,63 @@ class Prefs(bpy.types.KeyConfigPreferences): update=update_fn, ) + use_file_single_click: BoolProperty( + name="Open Folders on Single Click", + description=( + "Navigate into folders by clicking on them once instead of twice" + ), + default=False, + update=update_fn, + ) + def draw(self, layout): + from bpy import context + layout.use_property_split = True layout.use_property_decorate = False + prefs = context.preferences + is_select_left = (self.select_mouse == 'LEFT') + use_mouse_emulate_3_button = ( + prefs.inputs.use_mouse_emulate_3_button and + prefs.inputs.mouse_emulate_3_button_modifier == 'ALT' + ) # General settings. col = layout.column() - col.row().prop(self, "select_mouse", text="Select with Mouse Button", expand=True) - col.row().prop(self, "spacebar_action", text="Spacebar Action", expand=True) + col.row().prop(self, "select_mouse", text="Select with Mouse Button:", expand=True) + col.row().prop(self, "spacebar_action", text="Spacebar Action:", expand=True) if is_select_left: - col.row().prop(self, "gizmo_action", text="Activate Gizmo Event", expand=True) + col.row().prop(self, "gizmo_action", text="Activate Gizmo Event:", expand=True) else: - col.row().prop(self, "rmb_action", text="Right Mouse Select Action", expand=True) + col.row().prop(self, "rmb_action", text="Right Mouse Select Action:", expand=True) - # Checkboxes sub-layout. + col.row().prop(self, "tool_key_mode", expand=True) + + # Check-box sub-layout. col = layout.column() sub = col.column(align=True) row = sub.row() row.prop(self, "use_alt_click_leader") + + rowsub = row.row() if is_select_left: - row.prop(self, "use_alt_tool") + rowsub.prop(self, "use_alt_tool") + else: + rowsub.prop(self, "use_alt_cursor") + rowsub.active = not use_mouse_emulate_3_button + row = sub.row() row.prop(self, "use_select_all_toggle") - row.prop(self, "use_key_activate_tools", text="Key Activates Tools") # 3DView settings. col = layout.column() col.label(text="3D View") - col.row().prop(self, "v3d_tilde_action", text="Grave Accent / Tilde Action", expand=True) - col.row().prop(self, "v3d_mmb_action", text="Middle Mouse Action", expand=True) - col.row().prop(self, "v3d_alt_mmb_drag_action", text="Alt Middle Mouse Drag Action", expand=True) + col.row().prop(self, "v3d_tilde_action", text="Grave Accent / Tilde Action:", expand=True) + col.row().prop(self, "v3d_mmb_action", text="Middle Mouse Action:", expand=True) + col.row().prop(self, "v3d_alt_mmb_drag_action", text="Alt Middle Mouse Drag Action:", expand=True) # Checkboxes sub-layout. col = layout.column() @@ -237,6 +282,10 @@ class Prefs(bpy.types.KeyConfigPreferences): sub.prop(self, "use_pie_click_drag") sub.prop(self, "use_v3d_shade_ex_pie") + # File Browser settings. + col = layout.column() + col.label(text="File Browser") + col.row().prop(self, "use_file_single_click") blender_default = bpy.utils.execfile(os.path.join(DIRNAME, "keymap_data", "blender_default.py")) @@ -250,29 +299,33 @@ def load(): kc = context.window_manager.keyconfigs.new(IDNAME) kc_prefs = kc.preferences + is_select_left = (kc_prefs.select_mouse == 'LEFT') + use_mouse_emulate_3_button = ( + prefs.inputs.use_mouse_emulate_3_button and + prefs.inputs.mouse_emulate_3_button_modifier == 'ALT' + ) + keyconfig_data = blender_default.generate_keymaps( blender_default.Params( select_mouse=kc_prefs.select_mouse, - use_mouse_emulate_3_button=( - prefs.inputs.use_mouse_emulate_3_button and - prefs.inputs.mouse_emulate_3_button_modifier == 'ALT' - ), + use_mouse_emulate_3_button=use_mouse_emulate_3_button, spacebar_action=kc_prefs.spacebar_action, - use_key_activate_tools=kc_prefs.use_key_activate_tools, + use_key_activate_tools=(kc_prefs.tool_key_mode == 'TOOL'), v3d_tilde_action=kc_prefs.v3d_tilde_action, use_v3d_mmb_pan=(kc_prefs.v3d_mmb_action == 'PAN'), v3d_alt_mmb_drag_action=kc_prefs.v3d_alt_mmb_drag_action, use_select_all_toggle=kc_prefs.use_select_all_toggle, use_v3d_tab_menu=kc_prefs.use_v3d_tab_menu, use_v3d_shade_ex_pie=kc_prefs.use_v3d_shade_ex_pie, - use_gizmo_drag=( - kc_prefs.select_mouse == 'LEFT' and - kc_prefs.gizmo_action == 'DRAG' + use_gizmo_drag=(is_select_left and kc_prefs.gizmo_action == 'DRAG'), + use_fallback_tool=(True if is_select_left else (kc_prefs.rmb_action == 'FALLBACK_TOOL')), + use_alt_tool_or_cursor=( + (not use_mouse_emulate_3_button) and + (kc_prefs.use_alt_tool if is_select_left else kc_prefs.use_alt_cursor) ), - use_fallback_tool=(True if (kc_prefs.select_mouse == 'LEFT') else (kc_prefs.rmb_action == 'FALLBACK_TOOL')), - use_alt_tool=(kc_prefs.use_alt_tool and kc_prefs.select_mouse == 'LEFT'), use_alt_click_leader=kc_prefs.use_alt_click_leader, use_pie_click_drag=kc_prefs.use_pie_click_drag, + use_file_single_click=kc_prefs.use_file_single_click, ), ) |