diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c index 13fbd5d6f80..5d857293b88 100644 --- a/source/blender/python/BPY_menus.c +++ b/source/blender/python/BPY_menus.c @@ -95,6 +95,8 @@ static int bpymenu_group_atoi( char *str ) return PYMENU_MATERIALS; else if( !strcmp( str, "UV" ) ) return PYMENU_UV; + else if( !strcmp( str, "Image" ) ) + return PYMENU_IMAGE; else if( !strcmp( str, "FaceSelect" ) ) return PYMENU_FACESELECT; else if( !strcmp( str, "WeightPaint" ) ) @@ -154,6 +156,9 @@ char *BPyMenu_group_itoa( short menugroup ) case PYMENU_UV: return "UV"; break; + case PYMENU_IMAGE: + return "Image"; + break; case PYMENU_FACESELECT: return "FaceSelect"; break; diff --git a/source/blender/python/BPY_menus.h b/source/blender/python/BPY_menus.h index d51897da975..4556928dade 100644 --- a/source/blender/python/BPY_menus.h +++ b/source/blender/python/BPY_menus.h @@ -90,6 +90,7 @@ typedef enum { PYMENU_SYSTEM, PYMENU_THEMES, PYMENU_UV,/* UV editing tools, to go in UV/Image editor space, 'UV' menu */ + PYMENU_IMAGE,/* Image editing tools, to go in UV/Image editor space, 'Image' menu */ PYMENU_WIZARDS,/* complex 'app' scripts */ /* entries put after Wizards don't appear at the Scripts win->Scripts menu; diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index a21518c17e1..5bf52ddb63f 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -682,7 +682,10 @@ static void do_image_imagemenu(void *arg, int event) { Image *ima; char name[256]; - + + /* events >=20 are registered bpython scripts */ + if (event >= 20) BPY_menu_do_python(PYMENU_IMAGE, event - 20); + switch(event) { case 0: /* Open */ @@ -814,6 +817,8 @@ static uiBlock *image_imagemenu(void *arg_unused) { uiBlock *block; short yco= 0, menuwidth=150; + BPyMenu *pym; + int i = 0; block= uiNewBlock(&curarea->uiblocks, "image_imagemenu", UI_EMBOSSP, UI_HELV, curarea->headwin); uiBlockSetButmFunc(block, do_image_imagemenu, NULL); @@ -848,6 +853,14 @@ static uiBlock *image_imagemenu(void *arg_unused) // uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Realtime Texture Animation|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); } + /* note that we acount for the N previous entries with i+20: */ + for (pym = BPyMenuTable[PYMENU_IMAGE]; pym; pym = pym->next, i++) { + + uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, + NULL, 0.0, 0.0, 1, i+20, + pym->tooltip?pym->tooltip:pym->filename); + } + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -1127,7 +1140,7 @@ static uiBlock *image_uvsmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - /* note that we acount for the 3 previous entries with i+3: */ + /* note that we acount for the N previous entries with i+20: */ for (pym = BPyMenuTable[PYMENU_UV]; pym; pym = pym->next, i++) { uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19,