Adds a 'paint' floating panel to the image window to control brush settings for texture paint mode.

Also adds paint and properties to the view menu in image window.
This commit is contained in:
Johnny Matthews
2004-05-15 02:28:03 +00:00
parent dd2a4a0249
commit 95c546bd9d
3 changed files with 43 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ struct BWinEvent;
/* image handler codes */
#define IMAGE_HANDLER_PROPERTIES 30
#define IMAGE_HANDLER_PAINT 31
/* action handler codes */
#define ACTION_HANDLER_PROPERTIES 40

View File

@@ -66,6 +66,7 @@
#include "BDR_editobject.h"
#include "BDR_drawmesh.h"
#include "BIF_gl.h"
#include "BIF_space.h"
#include "BIF_screen.h"
@@ -75,6 +76,8 @@
#include "BIF_interface.h"
#include "BIF_editsima.h"
#include "BSE_trans_types.h"
/* Modules used */
#include "mydevice.h"
#include "blendef.h"
@@ -762,6 +765,32 @@ static void image_panel_properties(short cntrl) // IMAGE_HANDLER_PROPERTIES
image_editvertex_buts(block);
}
static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PROPERTIES
{
extern VPaint Gvp; /* from vpaint - this was copied from the paint panel*/
uiBlock *block;
block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
uiSetPanelHandler(IMAGE_HANDLER_PAINT); // for close and esc
if(uiNewPanel(curarea, block, "Paint", "Image", 10, 230, 318, 204)==0)
return;
/* Here we will define our stuff - this was copied from the paint panel*/
uiBlockBeginAlign(block);
uiDefButF(block, NUMSLI, 0, "R ", 979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
uiDefButF(block, NUMSLI, 0, "G ", 979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
uiDefButF(block, NUMSLI, 0, "B ", 979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
uiBlockEndAlign(block);
uiDefButF(block, NUMSLI, 0, "Opacity ", 979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
uiDefButF(block, NUMSLI, 0, "Size ", 979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
uiDefButF(block, COL, B_VPCOLSLI, "", 1176,100,28,80, &(Gvp.r), 0, 0, 0, 0, "");
}
static void image_blockhandlers(ScrArea *sa)
{
SpaceImage *sima= sa->spacedata.first;
@@ -776,7 +805,9 @@ static void image_blockhandlers(ScrArea *sa)
case IMAGE_HANDLER_PROPERTIES:
image_panel_properties(sima->blockhandler[a+1]);
break;
case IMAGE_HANDLER_PAINT:
image_panel_paint(sima->blockhandler[a+1]);
break;
}
/* clear action value for event */
sima->blockhandler[a+1]= 0;

View File

@@ -381,6 +381,12 @@ static void do_image_viewmenu(void *arg, int event)
G.f |= G_DRAWFACES;
allqueue(REDRAWIMAGE, 0);
break;
case 7: /* Properties Panel */
add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
break;
case 8: /* Paint Panel... */
add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -393,6 +399,10 @@ static uiBlock *image_viewmenu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "image_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
uiBlockSetButmFunc(block, do_image_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Paint Tool...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
if(G.f & G_DRAWFACES) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Draw Faces", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Draw Faces|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");