UI/Nodes: templates to edit nodes from the properties editor using a tree view,
to be used by cycles. For testing there's a panel in the node editor if you set debug to 777, didn't enable it because I'm not sure it's very useful there.
This commit is contained in:
@@ -1181,6 +1181,12 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
||||
|
||||
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
|
||||
}
|
||||
else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
|
||||
int tmp = rect->xmin;
|
||||
rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
|
||||
widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
|
||||
rect->xmin = tmp;
|
||||
}
|
||||
|
||||
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
|
||||
and offset the text label to accommodate it */
|
||||
@@ -1543,6 +1549,10 @@ static void widget_state(uiWidgetType *wt, int state)
|
||||
char red[4]= {255, 0, 0};
|
||||
widget_state_blend(wt->wcol.inner, red, 0.4f);
|
||||
}
|
||||
if(state & UI_BUT_NODE_ACTIVE) {
|
||||
char blue[4]= {86, 128, 194};
|
||||
widget_state_blend(wt->wcol.inner, blue, 0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
/* sliders use special hack which sets 'item' as inner when drawing filling */
|
||||
@@ -2530,6 +2540,29 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
|
||||
widgetbase_draw(&wtb, wcol);
|
||||
}
|
||||
|
||||
static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
||||
{
|
||||
/* silly node link button hacks */
|
||||
uiWidgetBase wtb;
|
||||
uiWidgetColors wcol_backup= *wcol;
|
||||
|
||||
widget_init(&wtb);
|
||||
|
||||
/* half rounded */
|
||||
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
||||
|
||||
wcol->inner[0] += 15;
|
||||
wcol->inner[1] += 15;
|
||||
wcol->inner[2] += 15;
|
||||
wcol->outline[0] += 15;
|
||||
wcol->outline[1] += 15;
|
||||
wcol->outline[2] += 15;
|
||||
|
||||
/* decoration */
|
||||
widgetbase_draw(&wtb, wcol);
|
||||
*wcol= wcol_backup;
|
||||
}
|
||||
|
||||
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
|
||||
{
|
||||
if(state & UI_ACTIVE) {
|
||||
@@ -2804,6 +2837,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
|
||||
wt.wcol_theme= &btheme->tui.wcol_menu;
|
||||
wt.draw= widget_menubut;
|
||||
break;
|
||||
|
||||
case UI_WTYPE_MENU_NODE_LINK:
|
||||
wt.wcol_theme= &btheme->tui.wcol_menu;
|
||||
wt.draw= widget_menunodebut;
|
||||
break;
|
||||
|
||||
case UI_WTYPE_PULLDOWN:
|
||||
wt.wcol_theme= &btheme->tui.wcol_pulldown;
|
||||
@@ -2996,7 +3034,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
||||
case MENU:
|
||||
case BLOCK:
|
||||
case ICONTEXTROW:
|
||||
if(!but->str[0] && but->icon)
|
||||
if(but->flag & UI_BUT_NODE_LINK)
|
||||
wt= widget_type(UI_WTYPE_MENU_NODE_LINK);
|
||||
else if(!but->str[0] && but->icon)
|
||||
wt= widget_type(UI_WTYPE_MENU_ICON_RADIO);
|
||||
else
|
||||
wt= widget_type(UI_WTYPE_MENU_RADIO);
|
||||
|
||||
Reference in New Issue
Block a user