diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-06 17:04:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-06 17:04:31 +0400 |
commit | dd8e2897ba19daac5191a341add9955e00798262 (patch) | |
tree | da30b474f92eb4c88887a061c31e19d7bb726151 /source/blender/editors/interface/interface_layout.c | |
parent | 2011ba50c84d61eff998812944354d444bd00041 (diff) |
new operator - bpy.ops.wm.call_menu(name="SOME_MT_menu")
This calls a registered menu as a popup so we can reuse header menus , currently used for Node editor and Sequencer add menu (Shift+A), can be used for toolbox too.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 11dfc44906a..b15be940eef 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1202,24 +1202,21 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun void uiItemM(uiLayout *layout, bContext *C, char *name, int icon, char *menuname) { - ARegion *ar= CTX_wm_region(C); MenuType *mt; - if(!menuname) - return; + mt= BKE_spacemenu_find(menuname, CTX_wm_area(C)->spacetype); - for(mt=ar->type->menutypes.first; mt; mt=mt->next) { - if(strcmp(menuname, mt->idname) == 0) { - if(!name) - name= mt->label; - if(layout->root->type == UI_LAYOUT_MENU && !icon) - icon= ICON_BLANK1; - ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL); - return; - } + if(mt==NULL) { + printf("uiItemM: not found %s\n", menuname); + return; } - printf("uiItemM: not found %s\n", menuname); + if(!name) + name= mt->label; + if(layout->root->type == UI_LAYOUT_MENU && !icon) + icon= ICON_BLANK1; + + ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL); } /* label item */ |