forked from bartvdbraak/blender
Added colorpicker in Panel for:
- Transform properties 3d win, while Vertex/Texture paint is on - Paint panel in UV window Note; both use the same GVP struct to store current color in. Also the function used now to add picker isn't complete... might need further thinking over. Consult me when you like them in more places.
This commit is contained in:
parent
5b0e27de5c
commit
4e9ddbdc4c
@ -746,13 +746,13 @@ static void image_panel_properties(short cntrl) // IMAGE_HANDLER_PROPERTIES
|
|||||||
char str[32];
|
char str[32];
|
||||||
|
|
||||||
sprintf(str, "Image: size %d x %d", G.sima->image->ibuf->x, G.sima->image->ibuf->y);
|
sprintf(str, "Image: size %d x %d", G.sima->image->ibuf->x, G.sima->image->ibuf->y);
|
||||||
uiDefBut(block, LABEL, 0, str, 10,180,300,19, 0, 0, 0, 0, 0, "");
|
uiDefBut(block, LABEL, B_NOP, str, 10,180,300,19, 0, 0, 0, 0, 0, "");
|
||||||
|
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
uiDefButS(block, TOG|BIT|1, B_TWINANIM, "Anim", 10,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of animated texture");
|
uiDefButS(block, TOG|BIT|1, B_TWINANIM, "Anim", 10,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of animated texture");
|
||||||
uiDefButS(block, NUM, B_TWINANIM, "Start:", 10,130,140,19, &G.sima->image->twsta, 0.0, 128.0, 0, 0, "Displays the start frame of an animated texture");
|
uiDefButS(block, NUM, B_TWINANIM, "Start:", 10,130,140,19, &G.sima->image->twsta, 0.0, 128.0, 0, 0, "Displays the start frame of an animated texture");
|
||||||
uiDefButS(block, NUM, B_TWINANIM, "End:", 10,110,140,19, &G.sima->image->twend, 0.0, 128.0, 0, 0, "Displays the end frame of an animated texture");
|
uiDefButS(block, NUM, B_TWINANIM, "End:", 10,110,140,19, &G.sima->image->twend, 0.0, 128.0, 0, 0, "Displays the end frame of an animated texture");
|
||||||
uiDefButS(block, NUM, 0, "Speed", 10,90,140,19, &G.sima->image->animspeed, 1.0, 100.0, 0, 0, "Displays Speed of the animation in frames per second");
|
uiDefButS(block, NUM, B_NOP, "Speed", 10,90,140,19, &G.sima->image->animspeed, 1.0, 100.0, 0, 0, "Displays Speed of the animation in frames per second");
|
||||||
uiBlockEndAlign(block);
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
@ -768,6 +768,7 @@ static void image_panel_properties(short cntrl) // IMAGE_HANDLER_PROPERTIES
|
|||||||
static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PROPERTIES
|
static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PROPERTIES
|
||||||
{
|
{
|
||||||
extern VPaint Gvp; /* from vpaint - this was copied from the paint panel*/
|
extern VPaint Gvp; /* from vpaint - this was copied from the paint panel*/
|
||||||
|
static float hsv[3], old[3]; // used as temp mem for picker
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
|
|
||||||
block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
|
block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
|
||||||
@ -776,18 +777,12 @@ static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PROPERTIES
|
|||||||
if(uiNewPanel(curarea, block, "Paint", "Image", 10, 230, 318, 204)==0)
|
if(uiNewPanel(curarea, block, "Paint", "Image", 10, 230, 318, 204)==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Here we will define our stuff - this was copied from the paint panel*/
|
uiBlockPickerButtons(block, &Gvp.r, hsv, old, 'r'); /* 'r' is for numbuts on right */
|
||||||
|
|
||||||
|
// offset= FPICK+2*DPICK+BPICK in interface.c... this goes wrong when defines change
|
||||||
uiBlockBeginAlign(block);
|
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, NUM, B_NOP, "A: ", 180+12+24,160,80,20, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
|
||||||
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, NUM, B_NOP, "Size ", 180+12+24,140,80,20, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
|
||||||
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, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,12 +108,14 @@
|
|||||||
#include "BDR_drawmesh.h"
|
#include "BDR_drawmesh.h"
|
||||||
#include "BDR_drawobject.h"
|
#include "BDR_drawobject.h"
|
||||||
#include "BDR_editobject.h"
|
#include "BDR_editobject.h"
|
||||||
|
#include "BDR_vpaint.h"
|
||||||
|
|
||||||
#include "BSE_view.h"
|
#include "BSE_view.h"
|
||||||
#include "BSE_drawview.h"
|
#include "BSE_drawview.h"
|
||||||
#include "BSE_headerbuttons.h"
|
#include "BSE_headerbuttons.h"
|
||||||
#include "BSE_seqaudio.h"
|
#include "BSE_seqaudio.h"
|
||||||
#include "BSE_filesel.h"
|
#include "BSE_filesel.h"
|
||||||
|
#include "BSE_trans_types.h"
|
||||||
|
|
||||||
#include "RE_renderconverter.h"
|
#include "RE_renderconverter.h"
|
||||||
|
|
||||||
@ -1461,8 +1463,10 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
|
|||||||
uiSetPanelHandler(VIEW3D_HANDLER_OBJECT); // for close and esc
|
uiSetPanelHandler(VIEW3D_HANDLER_OBJECT); // for close and esc
|
||||||
if(uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204)==0) return;
|
if(uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204)==0) return;
|
||||||
|
|
||||||
|
if((G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))==0) {
|
||||||
uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 18.0, 0, 0, "");
|
uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 18.0, 0, 0, "");
|
||||||
uiDefIDPoinBut(block, test_obpoin_but, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object");
|
uiDefIDPoinBut(block, test_obpoin_but, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object");
|
||||||
|
}
|
||||||
|
|
||||||
lim= 1000.0*MAX2(1.0, G.vd->grid);
|
lim= 1000.0*MAX2(1.0, G.vd->grid);
|
||||||
|
|
||||||
@ -1474,6 +1478,11 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
|
|||||||
else if(ob==G.obpose) {
|
else if(ob==G.obpose) {
|
||||||
v3d_posearmature_buts(block, ob, lim);
|
v3d_posearmature_buts(block, ob, lim);
|
||||||
}
|
}
|
||||||
|
else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT)) {
|
||||||
|
extern VPaint Gvp; /* from vpaint */
|
||||||
|
static float hsv[3], old[3]; // used as temp mem for picker
|
||||||
|
uiBlockPickerButtons(block, &Gvp.r, hsv, old, 'r'); /* 'r' is for numbuts on right */
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocX:", 10, 140, 140, 19, &(ob->loc[0]), -lim, lim, 100, 3, "");
|
uiDefButF(block, NUM, REDRAWVIEW3D, "LocX:", 10, 140, 140, 19, &(ob->loc[0]), -lim, lim, 100, 3, "");
|
||||||
|
@ -2097,7 +2097,8 @@ static void update_picker_buts(uiBlock *block, float *col)
|
|||||||
rgb_to_hsv(col[0], col[1], col[2], &h, &s, &v);
|
rgb_to_hsv(col[0], col[1], col[2], &h, &s, &v);
|
||||||
|
|
||||||
for(bt= block->buttons.first; bt; bt= bt->next) {
|
for(bt= block->buttons.first; bt; bt= bt->next) {
|
||||||
if(bt->str[0]=='R') {
|
if(bt->str[1]); // sting longer than 1 char
|
||||||
|
else if(bt->str[0]=='R') {
|
||||||
ui_set_but_val(bt, col[0]);
|
ui_set_but_val(bt, col[0]);
|
||||||
ui_check_but(bt);
|
ui_check_but(bt);
|
||||||
}
|
}
|
||||||
@ -2124,15 +2125,15 @@ static void update_picker_buts(uiBlock *block, float *col)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bt1 is palette but, bt2 is the parent button of the picker */
|
/* bt1 is palette but, col1 is original color */
|
||||||
static void do_palette_cb(void *bt1, void *bt2)
|
/* callback to copy from/to palette */
|
||||||
|
static void do_palette_cb(void *bt1, void *col1)
|
||||||
{
|
{
|
||||||
uiBut *but1= (uiBut *)bt1;
|
uiBut *but1= (uiBut *)bt1;
|
||||||
uiBut *but2= (uiBut *)bt2;
|
|
||||||
uiBut *but;
|
uiBut *but;
|
||||||
float col[3], *fp;
|
float *col= (float *)col1;
|
||||||
|
float *fp;
|
||||||
|
|
||||||
ui_get_but_vectorf(but2, col);
|
|
||||||
fp= (float *)but1->poin;
|
fp= (float *)but1->poin;
|
||||||
|
|
||||||
if( (get_qual() & LR_CTRLKEY) ) {
|
if( (get_qual() & LR_CTRLKEY) ) {
|
||||||
@ -2140,7 +2141,6 @@ static void do_palette_cb(void *bt1, void *bt2)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VECCOPY(col, fp);
|
VECCOPY(col, fp);
|
||||||
ui_set_but_vectorf(but2, col);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_picker_buts(but1->block, col);
|
update_picker_buts(but1->block, col);
|
||||||
@ -2151,13 +2151,14 @@ static void do_palette_cb(void *bt1, void *bt2)
|
|||||||
glFlush(); // flush display in subloops
|
glFlush(); // flush display in subloops
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bt1 is num but, bt2 is the parent button of the picker */
|
/* bt1 is num but, col1 is pointer to original color */
|
||||||
static void do_palette1_cb(void *bt1, void *bt2)
|
/* callback to handle changes in num-buts in picker */
|
||||||
|
static void do_palette1_cb(void *bt1, void *col1)
|
||||||
{
|
{
|
||||||
uiBut *but1= (uiBut *)bt1;
|
uiBut *but1= (uiBut *)bt1;
|
||||||
uiBut *but2= (uiBut *)bt2;
|
|
||||||
uiBut *but;
|
uiBut *but;
|
||||||
float *fp= NULL, col[3];
|
float *col= (float *)col1;
|
||||||
|
float *fp= NULL;
|
||||||
|
|
||||||
if(but1->str[0]=='H') fp= (float *)but1->poin;
|
if(but1->str[0]=='H') fp= (float *)but1->poin;
|
||||||
else if(but1->str[0]=='S') fp= ((float *)but1->poin)-1;
|
else if(but1->str[0]=='S') fp= ((float *)but1->poin)-1;
|
||||||
@ -2165,17 +2166,6 @@ static void do_palette1_cb(void *bt1, void *bt2)
|
|||||||
|
|
||||||
if(fp) {
|
if(fp) {
|
||||||
hsv_to_rgb(fp[0], fp[1], fp[2], col, col+1, col+2);
|
hsv_to_rgb(fp[0], fp[1], fp[2], col, col+1, col+2);
|
||||||
ui_set_but_vectorf(but2, col);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(but1->str[0]=='R') fp= (float *)but1->poin;
|
|
||||||
else if(but1->str[0]=='G') fp= ((float *)but1->poin)-1;
|
|
||||||
else if(but1->str[0]=='B') fp= ((float *)but1->poin)-2;
|
|
||||||
|
|
||||||
if(fp) {
|
|
||||||
ui_set_but_vectorf(but2, fp);
|
|
||||||
VECCOPY(col, fp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_picker_buts(but1->block, col);
|
update_picker_buts(but1->block, col);
|
||||||
@ -2187,139 +2177,103 @@ static void do_palette1_cb(void *bt1, void *bt2)
|
|||||||
glFlush(); // flush display in subloops
|
glFlush(); // flush display in subloops
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
/* color picker, Gimp version. mode: 't' = RGB buttons on top */
|
||||||
/* color picker, cube version */
|
/* col = read/write to, hsv/old = memory for temporal use */
|
||||||
static int ui_do_but_COL1(uiBut *but)
|
void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, char mode)
|
||||||
{
|
{
|
||||||
uiBlock *block;
|
|
||||||
uiBut *bt;
|
uiBut *bt;
|
||||||
ListBase listb={NULL, NULL};
|
float h;
|
||||||
float col[3], hsv[3], h;
|
|
||||||
int a;
|
int a;
|
||||||
short event;
|
|
||||||
|
|
||||||
// signal to prevent calling up color picker
|
if(mode=='t') {
|
||||||
if(but->a1 == -1 || but->pointype!=FLO) {
|
// safety, put in beginning otherwise tooltips wont work
|
||||||
uibut_do_func(but);
|
uiDefBut(block, LABEL, B_NOP, "", -DPICK,-DPICK, FPICK+3*DPICK+BPICK, FPICK+4*DPICK+BPICK+40, NULL, 0.0, 0.0, 0, 0, "");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
block= uiNewBlock(&listb, "colorpicker", UI_EMBOSSP, UI_HELV, but->win);
|
VECCOPY(old, col); // old color stored there, for palette_cb to work
|
||||||
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT;
|
|
||||||
block->themecol= TH_BUT_NUM;
|
|
||||||
|
|
||||||
// the cube intersections
|
// the cube intersection
|
||||||
bt= uiDefButF(block, HSVCUBE, 0, "", 0,DPICK+BPICK,SPICK,SPICK, (float *)but->poin, 0.0, 0.0, 0, 0, "");
|
bt= uiDefButF(block, HSVCUBE, B_NOP, "", 0,DPICK+BPICK,FPICK,FPICK, col, 0.0, 0.0, 2, 0, "");
|
||||||
uiButSetFlag(bt, UI_NO_HILITE);
|
uiButSetFlag(bt, UI_NO_HILITE);
|
||||||
bt= uiDefButF(block, HSVCUBE, 0, "", 0,2*DPICK+BPICK+SPICK,SPICK,SPICK, (float *)but->poin, 0.0, 0.0, 1, 0, "");
|
|
||||||
uiButSetFlag(bt, UI_NO_HILITE);
|
bt= uiDefButF(block, HSVCUBE, B_NOP, "", 0,0,FPICK,BPICK, col, 0.0, 0.0, 3, 0, "");
|
||||||
bt= uiDefButF(block, HSVCUBE, 0, "", DPICK+SPICK,2*DPICK+BPICK+SPICK,SPICK,SPICK, (float *)but->poin, 0.0, 0.0, 2, 0, "");
|
|
||||||
uiButSetFlag(bt, UI_NO_HILITE);
|
uiButSetFlag(bt, UI_NO_HILITE);
|
||||||
|
|
||||||
// palette
|
// palette
|
||||||
uiDefButF(block, COL, 0, "", 0,0,60,BPICK, (float *)but->poin, 0.0, 0.0, -1, 0, "");
|
bt=uiDefButF(block, COL, B_NOP, "", FPICK+DPICK, 0, BPICK,BPICK, old, 0.0, 0.0, -1, 0, "Old color, click to restore");
|
||||||
h= (DPICK+2*SPICK-64)/(UI_PALETTE_TOT/2.0);
|
uiButSetFunc(bt, do_palette_cb, bt, col);
|
||||||
for(a=0; a<UI_PALETTE_TOT/2; a++) {
|
uiDefButF(block, COL, B_NOP, "", FPICK+DPICK, BPICK+DPICK, BPICK,60-BPICK-DPICK, col, 0.0, 0.0, -1, 0, "Active color");
|
||||||
bt= uiDefButF(block, COL, 0, "", 65.0+(float)a*h, BPICK/2, h, BPICK/2, palette[a+UI_PALETTE_TOT/2], 0.0, 0.0, -1, 0, "");
|
|
||||||
uiButSetFunc(bt, do_palette_cb, bt, but);
|
h= (DPICK+BPICK+FPICK-64)/(UI_PALETTE_TOT/2.0);
|
||||||
bt= uiDefButF(block, COL, 0, "", 65.0+(float)a*h, 0, h, BPICK/2, palette[a], 0.0, 0.0, -1, 0, "");
|
uiBlockBeginAlign(block);
|
||||||
uiButSetFunc(bt, do_palette_cb, bt, but);
|
for(a= -1+UI_PALETTE_TOT/2; a>=0; a--) {
|
||||||
|
bt= uiDefButF(block, COL, B_NOP, "", FPICK+DPICK, 65.0+(float)a*h, BPICK/2, h, palette[a+UI_PALETTE_TOT/2], 0.0, 0.0, -1, 0, "Click to choose, hold CTRL to store in palette");
|
||||||
|
uiButSetFunc(bt, do_palette_cb, bt, col);
|
||||||
|
bt= uiDefButF(block, COL, B_NOP, "", FPICK+DPICK+BPICK/2, 65.0+(float)a*h, BPICK/2, h, palette[a], 0.0, 0.0, -1, 0, "Click to choose, hold CTRL to store in palette");
|
||||||
|
uiButSetFunc(bt, do_palette_cb, bt, col);
|
||||||
}
|
}
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
ui_get_but_vectorf(but, col);
|
|
||||||
rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
|
rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
|
||||||
|
|
||||||
bt= uiDefButF(block, NUM, 0, "R ", DPICK+SPICK,BPICK+DPICK+SPICK-20,SPICK/2,20, col, 0.0, 1.0, 10, 2, "");
|
if(mode=='t') { // on top
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
h= (FPICK+DPICK+BPICK)/3.0;
|
||||||
bt= uiDefButF(block, NUM, 0, "G ", DPICK+SPICK,BPICK+DPICK+SPICK-40,SPICK/2,20, col+1, 0.0, 1.0, 10, 2, "");
|
bt= uiDefButF(block, NUM, B_NOP, "R ", 0, BPICK+2*DPICK+FPICK+20, h,20, col, 0.0, 1.0, 10, 2, "");
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
bt= uiDefButF(block, NUM, 0, "B ", DPICK+SPICK,BPICK+DPICK+SPICK-60,SPICK/2,20, col+2, 0.0, 1.0, 10, 2, "");
|
bt= uiDefButF(block, NUM, B_NOP, "G ", h, BPICK+2*DPICK+FPICK+20, h,20, col+1, 0.0, 1.0, 10, 2, "");
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "B ", 2*h, BPICK+2*DPICK+FPICK+20, h,20, col+2, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
|
||||||
bt= uiDefButF(block, NUM, 0, "H ", DPICK+1.5*SPICK,BPICK+DPICK+SPICK-20,SPICK/2,20, hsv, 0.0, 1.0, 10, 2, "");
|
bt= uiDefButF(block, NUM, B_NOP, "H ", 0, BPICK+2*DPICK+FPICK, h,20, hsv, 0.0, 1.0, 10, 2, "");
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
bt= uiDefButF(block, NUM, 0, "S ", DPICK+1.5*SPICK,BPICK+DPICK+SPICK-40,SPICK/2,20, hsv+1, 0.0, 1.0, 10, 2, "");
|
bt= uiDefButF(block, NUM, B_NOP, "S ", h, BPICK+2*DPICK+FPICK, h,20, hsv+1, 0.0, 1.0, 10, 2, "");
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
bt= uiDefButF(block, NUM, 0, "V ", DPICK+1.5*SPICK,BPICK+DPICK+SPICK-60,SPICK/2,20, hsv+2, 0.0, 1.0, 10, 2, "");
|
bt= uiDefButF(block, NUM, B_NOP, "V ", 2*h, BPICK+2*DPICK+FPICK, h,20, hsv+2, 0.0, 1.0, 10, 2, "");
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
|
||||||
// safety
|
|
||||||
uiDefBut(block, LABEL, 0, "", -DPICK,-DPICK,2*SPICK+3*DPICK,2*SPICK+4*DPICK+BPICK, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
|
|
||||||
/* and lets go */
|
|
||||||
block->direction= UI_TOP;
|
|
||||||
ui_positionblock(block, but);
|
|
||||||
block->win= G.curscreen->mainwin;
|
|
||||||
event= uiDoBlocks(&listb, 0);
|
|
||||||
|
|
||||||
return but->retval;
|
|
||||||
}
|
}
|
||||||
#endif
|
else { // on side
|
||||||
|
float offs= FPICK+2*DPICK+BPICK;
|
||||||
|
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "R ", offs, 110, 80,20, col, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "G ", offs, 90, 80,20, col+1, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "B ", offs, 70, 80,20, col+2, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "H ", offs, 40, 80,20, hsv, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "S ", offs, 20, 80,20, hsv+1, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
bt= uiDefButF(block, NUM, B_NOP, "V ", offs, 0, 80,20, hsv+2, 0.0, 1.0, 10, 2, "");
|
||||||
|
uiButSetFunc(bt, do_palette1_cb, bt, col);
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* color picker, Gimp version */
|
|
||||||
static int ui_do_but_COL(uiBut *but)
|
static int ui_do_but_COL(uiBut *but)
|
||||||
{
|
{
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
uiBut *bt;
|
|
||||||
ListBase listb={NULL, NULL};
|
ListBase listb={NULL, NULL};
|
||||||
float col[3], hsv[3], h;
|
float hsv[3], old[3];
|
||||||
int a;
|
|
||||||
short event;
|
short event;
|
||||||
|
|
||||||
// signal to prevent calling up color picker
|
// signal to prevent calling up color picker
|
||||||
if(but->a1 == -1 || but->pointype!=FLO) {
|
if(but->a1 == -1 || but->pointype!=FLO) {
|
||||||
uibut_do_func(but);
|
uibut_do_func(but);
|
||||||
return 0;
|
return but->retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
block= uiNewBlock(&listb, "colorpicker", UI_EMBOSSP, UI_HELV, but->win);
|
block= uiNewBlock(&listb, "colorpicker", UI_EMBOSSP, UI_HELV, but->win);
|
||||||
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT;
|
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW;
|
||||||
block->themecol= TH_BUT_NUM;
|
block->themecol= TH_BUT_NUM;
|
||||||
|
|
||||||
// safety, put in beginning otherwise tooltips wont work
|
uiBlockPickerButtons(block, (float *)but->poin, hsv, old, 't');
|
||||||
uiDefBut(block, LABEL, 0, "", -DPICK,-DPICK, FPICK+3*DPICK+BPICK, FPICK+4*DPICK+BPICK+40, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
|
|
||||||
ui_get_but_vectorf(but, col);
|
|
||||||
VECCOPY(palette[UI_PALETTE_TOT], col); // old color stored there, for palette_cb to work
|
|
||||||
|
|
||||||
// the cube intersection
|
|
||||||
bt= uiDefButF(block, HSVCUBE, 0, "", 0,DPICK+BPICK,FPICK,FPICK, (float *)but->poin, 0.0, 0.0, 2, 0, "");
|
|
||||||
uiButSetFlag(bt, UI_NO_HILITE);
|
|
||||||
|
|
||||||
bt= uiDefButF(block, HSVCUBE, 0, "", 0,0,FPICK,BPICK, (float *)but->poin, 0.0, 0.0, 3, 0, "");
|
|
||||||
uiButSetFlag(bt, UI_NO_HILITE);
|
|
||||||
|
|
||||||
// palette
|
|
||||||
bt=uiDefButF(block, COL, 0, "rt", FPICK+DPICK, 0, BPICK,BPICK, palette[UI_PALETTE_TOT], 0.0, 0.0, -1, 0, "Old color, click to restore");
|
|
||||||
uiButSetFunc(bt, do_palette_cb, bt, but);
|
|
||||||
uiDefButF(block, COL, 0, "rt1", FPICK+DPICK, BPICK+DPICK, BPICK,60-BPICK-DPICK, col, 0.0, 0.0, -1, 0, "Active color");
|
|
||||||
|
|
||||||
h= (DPICK+BPICK+FPICK-64)/(UI_PALETTE_TOT/2.0);
|
|
||||||
for(a=0; a<UI_PALETTE_TOT/2; a++) {
|
|
||||||
bt= uiDefButF(block, COL, 0, "", FPICK+DPICK, 65.0+(float)a*h, BPICK/2, h, palette[a+UI_PALETTE_TOT/2], 0.0, 0.0, -1, 0, "Click to choose, hold CTRL to store in palette");
|
|
||||||
uiButSetFunc(bt, do_palette_cb, bt, but);
|
|
||||||
bt= uiDefButF(block, COL, 0, "", FPICK+DPICK+BPICK/2, 65.0+(float)a*h, BPICK/2, h, palette[a], 0.0, 0.0, -1, 0, "Click to choose, hold CTRL to store in palette");
|
|
||||||
uiButSetFunc(bt, do_palette_cb, bt, but);
|
|
||||||
}
|
|
||||||
|
|
||||||
// buttons
|
|
||||||
rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
|
|
||||||
|
|
||||||
h= (FPICK+DPICK+BPICK)/3.0;
|
|
||||||
bt= uiDefButF(block, NUM, 0, "R ", 0, BPICK+2*DPICK+FPICK+20, h,20, col, 0.0, 1.0, 10, 2, "");
|
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
|
||||||
bt= uiDefButF(block, NUM, 0, "G ", h, BPICK+2*DPICK+FPICK+20, h,20, col+1, 0.0, 1.0, 10, 2, "");
|
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
|
||||||
bt= uiDefButF(block, NUM, 0, "B ", 2*h, BPICK+2*DPICK+FPICK+20, h,20, col+2, 0.0, 1.0, 10, 2, "");
|
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
|
||||||
|
|
||||||
bt= uiDefButF(block, NUM, 0, "H ", 0, BPICK+2*DPICK+FPICK, h,20, hsv, 0.0, 1.0, 10, 2, "");
|
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
|
||||||
bt= uiDefButF(block, NUM, 0, "S ", h, BPICK+2*DPICK+FPICK, h,20, hsv+1, 0.0, 1.0, 10, 2, "");
|
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
|
||||||
bt= uiDefButF(block, NUM, 0, "V ", 2*h, BPICK+2*DPICK+FPICK, h,20, hsv+2, 0.0, 1.0, 10, 2, "");
|
|
||||||
uiButSetFunc(bt, do_palette1_cb, bt, but);
|
|
||||||
|
|
||||||
/* and lets go */
|
/* and lets go */
|
||||||
block->direction= UI_TOP;
|
block->direction= UI_TOP;
|
||||||
@ -2378,7 +2332,8 @@ static int ui_do_but_HSVCUBE(uiBut *but)
|
|||||||
}
|
}
|
||||||
else BIF_wait_for_statechange();
|
else BIF_wait_for_statechange();
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
return but->retval;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -456,6 +456,7 @@ void sample_vpaint() /* frontbuf */
|
|||||||
Gvp.b /= 255.0;
|
Gvp.b /= 255.0;
|
||||||
|
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
|
addqueue(curarea->win, REDRAW, 1); // needed for when panel is open...
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_vertexpaint()
|
void init_vertexpaint()
|
||||||
|
Loading…
Reference in New Issue
Block a user