2.5
- Made Normal (Sphere) button draw with nice AA (check in node editor) - Bugfix in alignment code, collumns were not drawing OK - Picker buttons draw swatches again, and made them work.
This commit is contained in:
parent
2e91f1b155
commit
8f620ea5f0
@ -612,6 +612,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
|
||||
|
||||
rect->xmax= floor(getsizex*(0.5+ 0.5*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
|
||||
rect->ymax= floor(getsizey*(0.5+ 0.5*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
|
||||
|
||||
}
|
||||
|
||||
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
|
||||
@ -2041,6 +2042,7 @@ static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
|
||||
else if(buts_are_horiz(but, next)) {
|
||||
/* check if this is already second row */
|
||||
if( prev && buts_are_horiz(prev, but)==0) {
|
||||
flag &= ~UI_BUT_ALIGN_LEFT;
|
||||
flag |= UI_BUT_ALIGN_TOP;
|
||||
/* exception case: bottom row */
|
||||
if(rows>0) {
|
||||
@ -2059,6 +2061,10 @@ static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
|
||||
flag |= UI_BUT_ALIGN_TOP;
|
||||
}
|
||||
else { /* next button switches to new row */
|
||||
|
||||
if(prev && buts_are_horiz(prev, but))
|
||||
flag |= UI_BUT_ALIGN_LEFT;
|
||||
|
||||
if( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
|
||||
if(prev)
|
||||
flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT;
|
||||
|
@ -819,7 +819,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
||||
glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f);
|
||||
size= (rect->xmax-rect->xmin)/200.f;
|
||||
glScalef(size, size, size);
|
||||
|
||||
|
||||
if(displist==0) {
|
||||
GLUquadricObj *qobj;
|
||||
|
||||
@ -838,13 +838,22 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
||||
else glCallList(displist);
|
||||
|
||||
/* restore */
|
||||
glPopMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
|
||||
|
||||
glDisable(GL_LIGHT7);
|
||||
|
||||
/* AA circle */
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_LINE_SMOOTH );
|
||||
glColor3ubv(wcol->inner);
|
||||
glutil_draw_lined_arc(0.0f, M_PI*2.0, 100.0f, 32);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_LINE_SMOOTH );
|
||||
|
||||
/* matrix after circle */
|
||||
glPopMatrix();
|
||||
|
||||
/* enable blender light */
|
||||
for(a=0; a<8; a++) {
|
||||
if(old[a])
|
||||
|
@ -311,8 +311,10 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
|
||||
static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
{
|
||||
if(but->type == COL)
|
||||
ui_set_but_vectorf(but, data->vec);
|
||||
if(but->type == COL) {
|
||||
if(but->a1 != -1) // this is not a color picker (weak!)
|
||||
ui_set_but_vectorf(but, data->vec);
|
||||
}
|
||||
else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
|
||||
ui_set_but_val(but, data->value);
|
||||
|
||||
|
@ -1054,18 +1054,17 @@ static void ui_update_block_buts_hex(uiBlock *block, char *hexcol)
|
||||
/* callback to copy from/to palette */
|
||||
static void do_palette_cb(bContext *C, void *bt1, void *col1)
|
||||
{
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
uiBut *but1= (uiBut *)bt1;
|
||||
float *col= (float *)col1;
|
||||
float *fp, hsv[3];
|
||||
|
||||
fp= (float *)but1->poin;
|
||||
|
||||
/* XXX 2.50 bad access, how to solve?
|
||||
*
|
||||
if( (get_qual() & LR_CTRLKEY) ) {
|
||||
if(win->eventstate->ctrl) {
|
||||
VECCOPY(fp, col);
|
||||
}
|
||||
else*/ {
|
||||
else {
|
||||
VECCOPY(col, fp);
|
||||
}
|
||||
|
||||
@ -1205,8 +1204,6 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch
|
||||
|
||||
// palette
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSP);
|
||||
|
||||
bt=uiDefButF(block, COL, retval, "", FPICK+DPICK, 0, BPICK,BPICK, old, 0.0, 0.0, -1, 0, "Old color, click to restore");
|
||||
uiButSetFunc(bt, do_palette_cb, bt, col);
|
||||
uiDefButF(block, COL, retval, "", FPICK+DPICK, BPICK+DPICK, BPICK,60-BPICK-DPICK, col, 0.0, 0.0, -1, 0, "Active color");
|
||||
@ -1221,8 +1218,6 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
// buttons
|
||||
rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
|
||||
sprintf(hexcol, "%02X%02X%02X", (unsigned int)(col[0]*255.0), (unsigned int)(col[1]*255.0), (unsigned int)(col[2]*255.0));
|
||||
|
@ -702,22 +702,22 @@ void node_header_buttons(const bContext *C, ARegion *ar)
|
||||
|
||||
xmax= GetButStringLength("View");
|
||||
uiDefPulldownBut(block, node_viewmenu, NULL,
|
||||
"View", xco, yco-2, xmax-3, 24, "");
|
||||
"View", xco, yco, xmax-3, 20, "");
|
||||
xco+= xmax;
|
||||
|
||||
xmax= GetButStringLength("Select");
|
||||
uiDefPulldownBut(block, node_selectmenu, NULL,
|
||||
"Select", xco, yco-2, xmax-3, 24, "");
|
||||
"Select", xco, yco, xmax-3, 20, "");
|
||||
xco+= xmax;
|
||||
|
||||
xmax= GetButStringLength("Add");
|
||||
uiDefPulldownBut(block, node_addmenu, NULL,
|
||||
"Add", xco, yco-2, xmax-3, 24, "");
|
||||
"Add", xco, yco, xmax-3, 20, "");
|
||||
xco+= xmax;
|
||||
|
||||
xmax= GetButStringLength("Node");
|
||||
uiDefPulldownBut(block, node_nodemenu, NULL,
|
||||
"Node", xco, yco-2, xmax-3, 24, "");
|
||||
"Node", xco, yco, xmax-3, 20, "");
|
||||
xco+= xmax;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user