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/space_node/drawnode.c | |
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/space_node/drawnode.c')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 47 |
1 files changed, 37 insertions, 10 deletions
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); } |