Fix [#21516] UI artifacts in array modifier
Modify the glClearColor used to draw disabled buttons, when creating a ROUNDBOX ui element. Made a convenience function and rippled it though, too.
This commit is contained in:
@@ -2318,6 +2318,22 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int rou
|
||||
|
||||
}
|
||||
|
||||
static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
|
||||
widget_init(&wtb);
|
||||
|
||||
/* half rounded */
|
||||
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
||||
|
||||
widgetbase_draw(&wtb, wcol);
|
||||
|
||||
/* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects
|
||||
* over the top to indicate disabled buttons */
|
||||
glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0);
|
||||
}
|
||||
|
||||
static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
@@ -2384,10 +2400,11 @@ static void widget_disabled(rcti *rect)
|
||||
/* can't use theme TH_BACK or TH_PANEL... undefined */
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, col);
|
||||
glColor4f(col[0], col[1], col[2], 0.5f);
|
||||
|
||||
/* need -1 and +1 to make it work right for aligned buttons,
|
||||
* but problem may be somewhere else? */
|
||||
glRectf(rect->xmin-1, rect->ymin, rect->xmax, rect->ymax+1);
|
||||
|
||||
glRectf(rect->xmin-1, rect->ymin-1, rect->xmax, rect->ymax+1);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
@@ -2504,6 +2521,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
|
||||
break;
|
||||
|
||||
case UI_WTYPE_BOX:
|
||||
wt.custom= widget_box;
|
||||
wt.wcol_theme= &btheme->tui.wcol_box;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user