Keymap: add generally useful popups to F-Keys 1..4

This allows key bindings: link/append and user-preferences
to be accessed via keys - without having to assign keys to each action.

- F1: Context sensitive help.
- F2: File Context Menu.
- F3: Search.
- F4: Window Context Menu.

Other keys F5..10, remain free,
ideally they can be kept for user actions.
This commit is contained in:
Campbell Barton 2018-07-01 17:51:31 +02:00
parent 36a9436d80
commit 192e5d65a7
2 changed files with 42 additions and 2 deletions

@ -579,11 +579,48 @@ class INFO_MT_help(Menu):
layout.operator("wm.splash", icon='BLENDER')
class TOPBAR_MT_file_specials(Menu):
bl_label = "File Context Menu"
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.link", text="Link", icon='LINK_BLEND')
layout.operator("wm.append", text="Append", icon='APPEND_BLEND')
layout.separator()
layout.menu("INFO_MT_file_import", icon='IMPORT')
layout.menu("INFO_MT_file_export", icon='EXPORT')
class TOPBAR_MT_window_specials(Menu):
bl_label = "Window Context Menu"
def draw(self, context):
layout = self.layout
layout.operator_context = 'EXEC_AREA'
layout.operator("wm.window_new")
layout.operator_context = 'INVOKE_AREA'
layout.operator("screen.area_dupli")
layout.separator()
layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
classes = (
TOPBAR_HT_upper_bar,
TOPBAR_HT_lower_bar,
TOPBAR_PT_pivot_point,
TOPBAR_PT_snapping,
TOPBAR_MT_file_specials,
TOPBAR_MT_window_specials,
INFO_MT_editor_menus,
INFO_MT_file,
INFO_MT_file_import,

@ -3986,11 +3986,14 @@ void wm_window_keymap(wmKeyConfig *keyconf)
/* debug/testing */
WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
#else
WM_keymap_add_item(keymap, "WM_OT_doc_view_manual_ui_context", F1KEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "TOPBAR_MT_file_specials", F2KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "WM_OT_search_menu", F3KEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "TOPBAR_MT_window_specials", F4KEY, KM_PRESS, 0, 0);
#endif
/* menus that can be accessed anywhere in blender */
WM_keymap_add_item(keymap, "WM_OT_search_menu", F3KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "WM_OT_search_menu", ACCENTGRAVEKEY, KM_CLICK, 0, 0);
WM_keymap_add_menu(keymap, "SCREEN_MT_user_menu", QKEY, KM_PRESS, 0, 0);