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/blenkernel | |
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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 22 |
2 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index ee04d4f47bc..b983c6f7dc4 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -222,6 +222,8 @@ const struct ListBase *BKE_spacetypes_list(void); void BKE_spacetype_register(struct SpaceType *st); void BKE_spacetypes_free(void); /* only for quitting blender */ +MenuType *BKE_spacemenu_find(const char *idname, int spacetype); + /* spacedata */ void BKE_spacedata_freelist(ListBase *lb); void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2); diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 661d0da1550..3567de5df40 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -343,3 +343,25 @@ unsigned int BKE_screen_visible_layers(bScreen *screen) return layer; } +MenuType *BKE_spacemenu_find(const char *idname, int spacetype) +{ + SpaceType *st= BKE_spacetype_from_id(spacetype); + ARegionType *art; + MenuType* mt; + + if(st==NULL) { + printf("space type %d is invalid\n", spacetype); + return NULL; + } + + if(idname==NULL) + return NULL; + + for(art= st->regiontypes.first; art; art= art->next) + for(mt=art->menutypes.first; mt; mt=mt->next) + if(strcmp(idname, mt->idname)==0) + return mt; + + return NULL; +} + |