new function WM_keymap_add_menu(), similar to WM_keymap_add_item() except it takes...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 17 Nov 2009 15:29:55 +0000 (15:29 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 17 Nov 2009 15:29:55 +0000 (15:29 +0000)
source/blender/editors/armature/armature_ops.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/object/object_ops.c
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_keymap.c

index 560a1458dfdf5b89b6bd1fad0f2ea2d92f4a4064..5bb0d67cfbfdbd119147637bdae409afb5e6ee20 100644 (file)
@@ -311,8 +311,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "POSE_OT_ik_add", IKEY, KM_PRESS, /*KM_CTRL|*/KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "POSE_OT_ik_clear", IKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
        
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", GKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_pose_group");
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_group", GKEY, KM_PRESS, KM_CTRL, 0);
        
                /* set flags */
        kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_SHIFT, 0);
index 6354fbfc1a876a3f0aa8d62d922ba0b3a1007823..1cf5e4b2e232030d4831c84ff54f50b09a2c8344 100644 (file)
@@ -251,8 +251,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "CURVE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
 
        /* menus */
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", HKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_hook");
+       WM_keymap_add_item(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
 
        ED_object_generic_keymap(keyconf, keymap, TRUE);
 }
index f69530d3907bb29f588d9def004fa444820a9a24..215f895f953f87eb94b1e91bbb0350c6662b3c9f 100644 (file)
@@ -266,8 +266,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "MESH_OT_skin", FKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); /* python */
        WM_keymap_add_item(keymap, "MESH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
        
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(kmi->ptr, "name", "INFO_MT_mesh_add");
+       WM_keymap_add_menu(keymap, "INFO_MT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
        
        WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
@@ -285,23 +284,12 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
 
        /* menus */
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", WKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_specials");
-
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", FKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_faces");
-       
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", EKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_edges");
-
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", VKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_vertices");
-
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", HKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_hook");
-
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", UKEY, KM_PRESS, 0, 0);
-    RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_uv_map");
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_specials", WKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_faces", FKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_edges", EKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_vertices", VKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0);
 
        ED_object_generic_keymap(keyconf, keymap, TRUE);
 }
index 898d9a15bd5442609312d4cf01d7d897c2ae7d32..f74ab0096ad7ea8c9a7dd3589b3f1c0aec1777f2 100644 (file)
@@ -284,19 +284,13 @@ void ED_keymap_object(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0);
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(kmi->ptr, "name", "INFO_MT_add");
+       WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
 
        WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
 
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_object_apply");
-
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", UKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_make_single_user");
-    
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", LKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_make_links");
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_object_apply", AKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_make_single_user", UKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_make_links", LKEY, KM_PRESS, KM_CTRL, 0);
 
        WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move_linked", DKEY, KM_PRESS, KM_ALT, 0);
index b78fc864a11fdfc5f9f39785496abfa5ff85e476..b52365145ac9ef6a43b71afa2f5307d07a668838 100644 (file)
@@ -108,8 +108,7 @@ void node_keymap(struct wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "NODE_OT_group_ungroup", GKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "NODE_OT_group_edit", TABKEY, KM_PRESS, 0, 0);
        
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(kmi->ptr, "name", "NODE_MT_add");
+       WM_keymap_add_menu(keymap, "NODE_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
 
        transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
 }
index 65a580d60f7e8369463fb7abfb1ecbd414eea838..73a2070ca54b091445885f87ee96ca33fa5033c3 100644 (file)
@@ -211,8 +211,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "SEQUENCER_OT_select_border", BKEY, KM_PRESS, 0, 0);
 
-       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(kmi->ptr, "name", "SEQUENCER_MT_add");
+       WM_keymap_add_menu(keymap, "SEQUENCER_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
        
        transform_keymap_for_space(keyconf, keymap, SPACE_SEQ);
 }
index 1e491bcff0b25d921ef38448f5ec2ba86d45f4a1..d4ba83b28863d2b5171184ad06eb528553317eda 100644 (file)
@@ -100,6 +100,8 @@ wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, char *idname, int t
                                                                 int val, int modifier, int keymodifier);
 wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type, 
                                                                 int val, int modifier, int keymodifier);
+wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, char *idname, int type,
+                                                                int val, int modifier, int keymodifier);
 void         WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
 char            *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
 
index 0ab9eb83f965242431cf02c3118551f6eaa0cf40..b3269a23277f4d7feba1a53a03878b9bb3a449ad 100644 (file)
@@ -193,6 +193,14 @@ wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, char *idname, int type, int v
        return kmi;
 }
 
+/* menu wrapper for WM_keymap_add_item */
+wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier)
+{
+       wmKeyMapItem *kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
+       RNA_string_set(kmi->ptr, "name", idname);
+       return kmi;
+}
+
 void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
 {
        if(BLI_findindex(&keymap->items, kmi) != -1) {