[Bf-blender-cvs] [192e5d65a74] blender2.8: Keymap: add generally useful popups to F-Keys 1..4

Campbell Barton noreply at git.blender.org
Sun Jul 1 18:08:03 CEST 2018


Commit: 192e5d65a746798f6bddf897570ff8aba55c9c5a
Author: Campbell Barton
Date:   Sun Jul 1 17:51:31 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB192e5d65a746798f6bddf897570ff8aba55c9c5a

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.

===================================================================

M	release/scripts/startup/bl_ui/space_topbar.py
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 19516fda301..f54a5903801 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -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,
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 496c9b1eb19..7a48d7e012c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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);



More information about the Bf-blender-cvs mailing list