diff options
author | M.G. Kishalmi <lmg@kishalmi.net> | 2011-01-09 21:59:35 +0300 |
---|---|---|
committer | M.G. Kishalmi <lmg@kishalmi.net> | 2011-01-09 21:59:35 +0300 |
commit | 84a464ab62e67eb21e12d0c3b0fad061c38d9e4a (patch) | |
tree | 873b6235f7f7c8349ecba0df0c1e864125f6191e /source/blender/editors | |
parent | 4a8dd84625c1f88abb09ae853cf32130f5674335 (diff) |
several cosmetic changes to the node-editor
+ changed lines connecting nodes:
they now use a linewidth of 1.5px for the light foreground and 4px for the dark background.
this should fix node-lines not being visible on almost black or all white backdrops.
+ muted nodes now also show a red tinted header if they are hidden (collapsed)
+ both active and selected nodes show a (now properly antialiased) highlighting frame
+ fixed a small error in dropshadow code resulting in a gap at borders
+ fixed a tiny error for the collapsing indicators (triangles) - they were not symmetrical.
Ton will add proper theme colors for the node-editor in the coming days.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 47 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 49 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_intern.h | 2 |
5 files changed, 74 insertions, 31 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index b74165801ce..cf6b0652b22 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1599,7 +1599,7 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int select) /* outline emphasis */ glEnable( GL_LINE_SMOOTH ); glColor4ub(0, 0, 0, 100); - uiDrawBox(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, radius); + uiDrawBox(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, radius+0.5f); glDisable( GL_LINE_SMOOTH ); glDisable(GL_BLEND); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 2b6c18c5635..d819ecd7ec8 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -323,13 +323,14 @@ void uiPanelPop(uiBlock *UNUSED(block)) } /* triangle 'icon' for panel header */ +/* NOTE - this seems to be only used for hiding nodes now */ void ui_draw_tria_icon(float x, float y, char dir) { if(dir=='h') { - ui_draw_anti_tria(x-1, y, x-1, y+11.0, x+9, y+6.25); + ui_draw_anti_tria( x-3,y-5, x-3,y+5, x+7,y ); } else { - ui_draw_anti_tria(x-3, y+10, x+8-1, y+10, x+4.25-2, y); + ui_draw_anti_tria( x-5,y+3, x+5,y+3, x,y-7); } } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 85b52312f56..4590cfe7442 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1480,7 +1480,7 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa } #define LINK_RESOL 24 -void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int th_col2, int do_shaded) +void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 ) { float coord_array[LINK_RESOL+1][2]; @@ -1488,32 +1488,59 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t float dist, spline_step = 0.0f; int i; + /* store current linewidth */ + float linew; + glGetFloatv(GL_LINE_WIDTH, &linew); + /* we can reuse the dist variable here to increment the GL curve eval amount*/ dist = 1.0f/(float)LINK_RESOL; + glEnable(GL_LINE_SMOOTH); + + if(do_triple) { + UI_ThemeColorShadeAlpha(th_col3, -80, -120); + glLineWidth(4.0f); + + glBegin(GL_LINE_STRIP); + for(i=0; i<=LINK_RESOL; i++) { + glVertex2fv(coord_array[i]); + } + glEnd(); + } + + UI_ThemeColor(th_col1); + glLineWidth(1.5f); + glBegin(GL_LINE_STRIP); for(i=0; i<=LINK_RESOL; i++) { if(do_shaded) { UI_ThemeColorBlend(th_col1, th_col2, spline_step); spline_step += dist; - } + } glVertex2fv(coord_array[i]); } glEnd(); + + glDisable(GL_LINE_SMOOTH); + + /* restore previuos linewidth */ + glLineWidth(linew); } } /* note; this is used for fake links in groups too */ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) { - int do_shaded= 1, th_col1= TH_WIRE, th_col2= TH_WIRE; + int do_shaded= 0, th_col1= TH_HEADER, th_col2= TH_HEADER; + int do_triple= 0, th_col3= TH_WIRE; if(link->fromnode==NULL && link->tonode==NULL) return; + /* new connection */ if(link->fromnode==NULL || link->tonode==NULL) { - UI_ThemeColor(TH_WIRE); - do_shaded= 0; + th_col1 = TH_ACTIVE; + do_triple = 1; } else { /* going to give issues once... */ @@ -1524,8 +1551,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) /* a bit ugly... but thats how we detect the internal group links */ if(link->fromnode==link->tonode) { - UI_ThemeColorBlend(TH_BACK, TH_WIRE, 0.25f); - do_shaded= 0; + th_col1 = TH_GRID; } else { /* check cyclic */ @@ -1534,15 +1560,16 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) th_col1= TH_EDGE_SELECT; if(link->tonode->flag & SELECT) th_col2= TH_EDGE_SELECT; + do_shaded= 1; + do_triple= 1; } else { - UI_ThemeColor(TH_REDALERT); - do_shaded= 0; + th_col1 = TH_REDALERT; } } } - node_draw_link_bezier(v2d, snode, link, th_col1, th_col2, do_shaded); + node_draw_link_bezier(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 5028d1ca1d7..7de19c6b9e2 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -449,7 +449,6 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) } /* outputs, draw lines */ - UI_ThemeColor(TH_REDALERT); glEnable(GL_BLEND); glEnable( GL_LINE_SMOOTH ); @@ -460,17 +459,17 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) if(sock->type==SOCK_VALUE && valsock) { link.fromsock= valsock; - node_draw_link_bezier(v2d, snode, &link, TH_WIRE, TH_WIRE, 0); + node_draw_link_bezier(v2d, snode, &link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE); valsock= NULL; } if(sock->type==SOCK_VECTOR && vecsock) { link.fromsock= vecsock; - node_draw_link_bezier(v2d, snode, &link, TH_WIRE, TH_WIRE, 0); + node_draw_link_bezier(v2d, snode, &link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE); vecsock= NULL; } if(sock->type==SOCK_RGBA && colsock) { link.fromsock= colsock; - node_draw_link_bezier(v2d, snode, &link, TH_WIRE, TH_WIRE, 0); + node_draw_link_bezier(v2d, snode, &link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE); colsock= NULL; } } @@ -715,12 +714,13 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10); /* open/close entirely? */ - ui_draw_tria_icon(rct->xmin+8.0f, rct->ymax-NODE_DY+4.0f, 'v'); + ui_draw_tria_icon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v'); + /* this isn't doing anything for the label, so commenting out if(node->flag & SELECT) UI_ThemeColor(TH_TEXT_HI); else - UI_ThemeColor(TH_TEXT); + UI_ThemeColor(TH_TEXT); */ if(node->flag & NODE_CUSTOM_NAME) BLI_strncpy(showname, node->name, sizeof(showname)); @@ -744,12 +744,19 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* scaling indicator */ node_scaling_widget(TH_NODE, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect); - /* outline active emphasis */ - if(node->flag & NODE_ACTIVE) { + /* outline active and selected emphasis */ + if( node->flag & (NODE_ACTIVE|SELECT) ) { glEnable(GL_BLEND); - glColor4ub(200, 200, 200, 140); - uiSetRoundBox(15-4); - uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); + glEnable( GL_LINE_SMOOTH ); + /* using different shades of TH_TEXT_HI for the empasis, like triangle */ + if( node->flag & NODE_ACTIVE ) + UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40); + else + UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120); + uiSetRoundBox(15-4); // round all corners except lower right + uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); + + glDisable( GL_LINE_SMOOTH ); glDisable(GL_BLEND); } @@ -850,14 +857,22 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b ui_dropshadow(rct, hiddenrad, snode->aspect, node->flag & SELECT); /* body */ - UI_ThemeColor(color_id); + UI_ThemeColor(color_id); + if(node->flag & NODE_MUTED) + UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); - /* outline active emphasis */ - if(node->flag & NODE_ACTIVE) { + /* outline active and selected emphasis */ + if( node->flag & (NODE_ACTIVE|SELECT) ) { glEnable(GL_BLEND); - glColor4ub(200, 200, 200, 140); - uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); + glEnable( GL_LINE_SMOOTH ); + /* using different shades of TH_TEXT_HI for the empasis, like triangle */ + if( node->flag & NODE_ACTIVE ) + UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40); + else + UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120); + uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); + glDisable( GL_LINE_SMOOTH ); glDisable(GL_BLEND); } @@ -868,7 +883,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10); /* open entirely icon */ - ui_draw_tria_icon(rct->xmin+9.0f, centy-6.0f, 'h'); + ui_draw_tria_icon(rct->xmin+10.0f, centy, 'h'); /* disable lines */ if(node->flag & NODE_MUTED) diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index cba491deb01..cfe32846124 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -68,7 +68,7 @@ void NODE_OT_select_same_type_prev(wmOperatorType *ot); /* drawnode.c */ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link); -void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int th_col2, int do_shaded); +void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 ); int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, float coord_array[][2], int resol); void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage); |