Added "VertexPaint" slot for python menus

This commit is contained in:
2006-05-07 13:09:29 +00:00
parent 390380e97b
commit bb52e70c8a
3 changed files with 19 additions and 0 deletions

View File

@@ -99,6 +99,8 @@ static int bpymenu_group_atoi( char *str )
return PYMENU_FACESELECT;
else if( !strcmp( str, "WeightPaint" ) )
return PYMENU_WEIGHTPAINT;
else if( !strcmp( str, "VertexPaint" ) )
return PYMENU_VERTEXPAINT;
/* "Misc" or an inexistent group name: use misc */
else
return PYMENU_MISC;
@@ -158,6 +160,9 @@ char *BPyMenu_group_itoa( short menugroup )
case PYMENU_WEIGHTPAINT:
return "WeightPaint";
break;
case PYMENU_VERTEXPAINT:
return "VertexPaint";
break;
case PYMENU_MISC:
return "Misc";
break;

View File

@@ -97,6 +97,7 @@ typedef enum {
PYMENU_FACESELECT,
PYMENU_WEIGHTPAINT,
PYMENU_VERTEXPAINT,
PYMENU_HELP,/*Main Help menu items - prob best to leave for 'official' ones*/
PYMENU_HELPSYSTEM,/* Resources, troubleshooting, system tools */
PYMENU_HELPWEBSITES,/* Help -> Websites submenu */

View File

@@ -3542,6 +3542,9 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
/* vertex paint menu */
static void do_view3d_vpaintmenu(void *arg, int event)
{
/* events >= 2 are registered bpython scripts */
if (event >= 2) BPY_menu_do_python(PYMENU_VERTEXPAINT, event - 2);
switch(event) {
case 0: /* undo vertex painting */
vpaint_undo();
@@ -3561,6 +3564,8 @@ static uiBlock *view3d_vpaintmenu(void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
BPyMenu *pym;
int i=0;
block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
uiBlockSetButmFunc(block, do_view3d_vpaintmenu, NULL);
@@ -3568,6 +3573,14 @@ static uiBlock *view3d_vpaintmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
/* note that we account for the 2 previous entries with i+2:
even if the last item isnt displayed, it dosent matter */
for (pym = BPyMenuTable[PYMENU_VERTEXPAINT]; 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+2,
pym->tooltip?pym->tooltip:pym->filename);
}
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}