diff options
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 204 |
1 files changed, 121 insertions, 83 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index c81dc93cb0b..e5a5868bc7d 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -82,7 +82,7 @@ #include "node_intern.h" -// XXX interface.h +/* XXX interface.h */ extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select); /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */ @@ -140,7 +140,8 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v) block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN); - layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), FALSE); + layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, + args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), FALSE); uiItemR(layout, &args->ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NONE); @@ -344,7 +345,7 @@ static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0); } -static float _sample_col[4]; // bad bad, 2.5 will do better? +static float _sample_col[4]; /* bad bad, 2.5 will do better?... no it won't... */ #define SAMPLE_FLT_ISNONE FLT_MAX void ED_node_sample_set(const float col[4]) { @@ -396,7 +397,7 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA * nor, 0.0f, 1.0f, 0, 0, ""); uiButSetFunc(bt, node_normal_cb, ntree, node); } -#if 0 // not used in 2.5x yet +#if 0 /* not used in 2.5x yet */ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) { Main *bmain = CTX_data_main(C); @@ -649,7 +650,8 @@ static void update_group_output_cb(bContext *UNUSED(C), void *UNUSED(snode_v), v ntreeUpdateTree(ngroup); } -static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock, int in_out, float xoffset, float yoffset) +static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock, + int in_out, float xoffset, float yoffset) { bNodeTree *ngroup = (bNodeTree *)gnode->id; uiBut *bt; @@ -671,7 +673,8 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket * } } -static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode, bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out) +static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode, + bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out) { bNodeTree *ngroup = (bNodeTree *)gnode->id; bNodeSocketType *stype = ntreeGetSocketType(gsock ? gsock->type : sock->type); @@ -721,12 +724,14 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt if (gsock) { draw_group_socket_name(snode, gnode, gsock, in_out, offset, 0); if (stype->buttonfunc) - stype->buttonfunc(C, gnode->block, ngroup, NULL, gsock, "", gsock->locx + offset, gsock->locy - NODE_DY, colw); + stype->buttonfunc(C, gnode->block, ngroup, NULL, gsock, "", + gsock->locx + offset, gsock->locy - NODE_DY, colw); } else { draw_group_socket_name(snode, gnode, sock, in_out, offset, 0); if (stype->buttonfunc) - stype->buttonfunc(C, gnode->block, ngroup, NULL, sock, "", sock->locx + offset, sock->locy - NODE_DY, colw); + stype->buttonfunc(C, gnode->block, ngroup, NULL, sock, "", + sock->locx + offset, sock->locy - NODE_DY, colw); } } else { @@ -789,7 +794,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN glEnable(GL_BLEND); uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70); - uiDrawBox(GL_POLYGON, rect.xmin - node_group_frame, rect.ymax, rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD); + uiDrawBox(GL_POLYGON, + rect.xmin - node_group_frame, rect.ymax, + rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD); /* backdrop body */ UI_ThemeColorShadeAlpha(TH_BACK, -8, -70); @@ -824,7 +831,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN uiSetRoundBox(UI_CNR_ALL); glColor4ub(200, 200, 200, 140); glEnable(GL_LINE_SMOOTH); - uiDrawBox(GL_LINE_LOOP, rect.xmin - node_group_frame, rect.ymin, rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD); + uiDrawBox(GL_LINE_LOOP, + rect.xmin - node_group_frame, rect.ymin, + rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -994,7 +1003,7 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN float alpha; UI_GetThemeColor4ubv(TH_NODE_FRAME, color); - alpha = (float)(color[3])/255.0f; + alpha = (float)(color[3]) / 255.0f; /* skip if out of view */ if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax || @@ -1028,7 +1037,9 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN else UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40); uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); + uiDrawBox(GL_LINE_LOOP, + rct->xmin, rct->ymin, + rct->xmax, rct->ymax, BASIS_RAD); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -1074,7 +1085,7 @@ static void node_buts_frame_details(uiLayout *layout, bContext *UNUSED(C), Point } -#define NODE_REROUTE_SIZE 8.0f +#define NODE_REROUTE_SIZE 8.0f static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree), bNode *node) { @@ -1086,36 +1097,36 @@ static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntr nodeToView(node, 0.0f, 0.0f, &locx, &locy); /* reroute node has exactly one input and one output, both in the same place */ - nsock= node->outputs.first; - nsock->locx= locx; - nsock->locy= locy; + nsock = node->outputs.first; + nsock->locx = locx; + nsock->locy = locy; - nsock= node->inputs.first; - nsock->locx= locx; - nsock->locy= locy; - - node->width = size*2; - node->totr.xmin= locx - size; - node->totr.xmax= locx + size; - node->totr.ymax= locy + size; - node->totr.ymin= locy - size; + nsock = node->inputs.first; + nsock->locx = locx; + nsock->locy = locy; + + node->width = size * 2; + node->totr.xmin = locx - size; + node->totr.xmax = locx + size; + node->totr.ymax = locy + size; + node->totr.ymin = locy - size; } static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(snode), bNodeTree *ntree, bNode *node) { bNodeSocket *sock; - #if 0 /* UNUSED */ - rctf *rct= &node->totr; +#if 0 /* UNUSED */ + rctf *rct = &node->totr; float size = NODE_REROUTE_SIZE; - #endif - float socket_size= NODE_SOCKSIZE; +#endif + float socket_size = NODE_SOCKSIZE; /* skip if out of view */ if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax || - node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) { + node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) { uiEndBlock(C, node->block); - node->block= NULL; + node->block = NULL; return; } @@ -1134,12 +1145,12 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( if (node->flag & (NODE_ACTIVE | SELECT)) { glEnable(GL_BLEND); 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, size); + /* 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, size); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -1149,13 +1160,13 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( /* only draw input socket. as they all are placed on the same position. * highlight also if node itself is selected, since we don't display the node body separately! */ - for (sock= node->inputs.first; sock; sock= sock->next) { + for (sock = node->inputs.first; sock; sock = sock->next) { node_socket_circle_draw(ntree, sock, socket_size, (sock->flag & SELECT) || (node->flag & SELECT)); } uiEndBlock(C, node->block); uiDrawBlock(C, node->block); - node->block= NULL; + node->block = NULL; } /* Special tweak area for reroute node. @@ -1164,12 +1175,12 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( static int node_tweak_area_reroute(bNode *node, int x, int y) { /* square of tweak radius */ - static const float tweak_radius_sq = 576; /* 24*24 */ + static const float tweak_radius_sq = 576; /* 24 * 24 */ bNodeSocket *sock = node->inputs.first; float dx = sock->locx - x; float dy = sock->locy - y; - return (dx*dx + dy*dy <= tweak_radius_sq); + return (dx * dx + dy * dy <= tweak_radius_sq); } static void node_common_set_butfunc(bNodeType *ntype) @@ -1197,16 +1208,17 @@ static void node_common_set_butfunc(bNodeType *ntype) ntype->resize_area_func = node_resize_area_frame; break; case NODE_REROUTE: - ntype->drawfunc= node_draw_reroute; - ntype->drawupdatefunc= node_update_reroute; - ntype->tweak_area_func= node_tweak_area_reroute; + ntype->drawfunc = node_draw_reroute; + ntype->drawupdatefunc = node_update_reroute; + ntype->tweak_area_func = node_tweak_area_reroute; break; } } /* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */ -static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr) +static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, + PointerRNA *imaptr, PointerRNA *iuserptr) { uiLayout *col; int source; @@ -1950,7 +1962,8 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block, imfptr = RNA_pointer_get(&inputptr, "format"); imtype_prop = RNA_struct_find_property(&imfptr, "file_format"); - RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); + RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop, + RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); uiBlockSetEmboss(block, UI_EMBOSSP); uiItemL(row, imtype_name, 0); uiBlockSetEmboss(block, UI_EMBOSSN); @@ -1988,19 +2001,23 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C /* using different collection properties if multilayer format is enabled */ if (multilayer) { uiTemplateList(layout, C, ptr, "layer_slots", ptr, "active_input_index", NULL, 0, 0, 0); - RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr); + RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"), + active_index, &active_input_ptr); } else { uiTemplateList(layout, C, ptr, "file_slots", ptr, "active_input_index", NULL, 0, 0, 0); - RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"), active_index, &active_input_ptr); + RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"), + active_index, &active_input_ptr); } /* XXX collection lookup does not return the ID part of the pointer, setting this manually here */ active_input_ptr.id.data = ptr->id.data; row = uiLayoutRow(layout, TRUE); - op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); + op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", + ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&op_ptr, "direction", 1); - op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); + op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", + ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&op_ptr, "direction", 2); if (active_input_ptr.data) { @@ -2011,7 +2028,8 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C uiItemL(col, IFACE_("Layer:"), 0); row = uiLayoutRow(col, FALSE); uiItemR(row, &active_input_ptr, "name", 0, "", 0); - uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); + uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", + ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); } else { uiLayout *row, *col; @@ -2020,7 +2038,8 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C uiItemL(col, IFACE_("File Path:"), 0); row = uiLayoutRow(col, FALSE); uiItemR(row, &active_input_ptr, "path", 0, "", 0); - uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); + uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", + ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY); /* format details for individual files */ imfptr = RNA_pointer_get(&active_input_ptr, "format"); @@ -2468,7 +2487,7 @@ static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *p static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node= ptr->data; + bNode *node = ptr->data; uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL); @@ -2691,7 +2710,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) ntype->uibackdropfunc = node_composit_backdrop_viewer; break; case CMP_NODE_MASK: - ntype->uifunc= node_composit_buts_mask; + ntype->uifunc = node_composit_buts_mask; break; case CMP_NODE_KEYINGSCREEN: ntype->uifunc = node_composit_buts_keyingscreen; @@ -2767,7 +2786,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe row = uiLayoutRow(col, FALSE); uiItemR(row, &tex_ptr, "noise_basis_2", UI_ITEM_R_EXPAND, NULL, ICON_NONE); row = uiLayoutRow(col, FALSE); - uiLayoutSetActive(row, !(RNA_enum_get(&tex_ptr, "wood_type") == TEX_BAND || RNA_enum_get(&tex_ptr, "wood_type") == TEX_RING)); + uiLayoutSetActive(row, !(ELEM(tex->stype, TEX_BAND, TEX_RING))); uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); break; @@ -2979,7 +2998,8 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) glPixelZoom(snode->zoom, snode->zoom); /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ - glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ((unsigned char *)ibuf->rect) + ofs); + glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, + ((unsigned char *)ibuf->rect) + ofs); glPixelZoom(1.0f, 1.0f); } @@ -3015,7 +3035,7 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) } } - /// @note draw selected info on backdrop + /** @note draw selected info on backdrop */ if (snode->edittree) { bNode *node = snode->edittree->nodes.first; while (node) { @@ -3123,37 +3143,46 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa deltay = vec[3][1] - vec[0][1]; /* check direction later, for top sockets */ if (fromreroute) { - if (ABS(deltax)>ABS(deltay)) { - vec[1][1]= vec[0][1]; - vec[1][0]= vec[0][0]+(deltax>0?dist:-dist); - } else { - vec[1][0]= vec[0][0]; - vec[1][1]= vec[0][1]+(deltay>0?dist:-dist); + if (ABS(deltax) > ABS(deltay)) { + vec[1][1] = vec[0][1]; + vec[1][0] = vec[0][0] + (deltax > 0 ? dist : -dist); + } + else { + vec[1][0] = vec[0][0]; + vec[1][1] = vec[0][1] + (deltay > 0 ? dist : -dist); } - } else { + } + else { vec[1][0] = vec[0][0] + dist; vec[1][1] = vec[0][1]; } if (toreroute) { - if (ABS(deltax)>ABS(deltay)) { - vec[2][1]= vec[3][1]; - vec[2][0]= vec[3][0]+ (deltax>0?-dist:dist); - } else { - vec[2][0]= vec[3][0]; - vec[2][1]= vec[3][1]+(deltay>0?-dist:dist); + if (ABS(deltax) > ABS(deltay)) { + vec[2][1] = vec[3][1]; + vec[2][0] = vec[3][0] + (deltax > 0 ? -dist : dist); + } + else { + vec[2][0] = vec[3][0]; + vec[2][1] = vec[3][1] + (deltay > 0 ? -dist : dist); } - } else { + } + else { vec[2][0] = vec[3][0] - dist; vec[2][1] = vec[3][1]; } - if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) ; /* clipped */ - else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) ; /* clipped */ + if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) { + /* clipped */ + } + else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) { + /* clipped */ + } else { - /* always do all three, to prevent data hanging around */ - BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2); - BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2); + BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], + coord_array[0] + 0, resol, sizeof(float) * 2); + BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], + coord_array[0] + 1, resol, sizeof(float) * 2); return 1; } @@ -3161,9 +3190,10 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa } #define LINK_RESOL 24 -#define LINK_ARROW 12 /* position of arrow on the link, LINK_RESOL/2 */ +#define LINK_ARROW 12 /* position of arrow on the link, LINK_RESOL/2 */ #define ARROW_SIZE 7 -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) +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]; @@ -3181,7 +3211,9 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t glEnable(GL_LINE_SMOOTH); - drawarrow = (link->tonode && (link->tonode->type == NODE_REROUTE)) && (link->fromnode && (link->fromnode->type == NODE_REROUTE)); + drawarrow = ((link->tonode && (link->tonode->type == NODE_REROUTE)) && + (link->fromnode && (link->fromnode->type == NODE_REROUTE))); + if (drawarrow) { /* draw arrow in line segment LINK_ARROW */ float d_xy[2], len; @@ -3258,6 +3290,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t } } +#if 0 /* not used in 2.5x yet */ static void node_link_straight_points(View2D *UNUSED(v2d), SpaceNode *snode, bNodeLink *link, float coord_array[][2]) { if (link->fromsock) { @@ -3280,7 +3313,8 @@ static void node_link_straight_points(View2D *UNUSED(v2d), SpaceNode *snode, bNo } } -void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3) +void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, + int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3) { float coord_array[2][2]; float linew; @@ -3315,11 +3349,13 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int for (i = 0; i < LINK_RESOL - 1; ++i) { float t = (float)i / (float)(LINK_RESOL - 1); UI_ThemeColorBlend(th_col1, th_col2, t); - glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]); + glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], + (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]); t = (float)(i + 1) / (float)(LINK_RESOL - 1); UI_ThemeColorBlend(th_col1, th_col2, t); - glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]); + glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], + (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]); } glEnd(); } @@ -3327,7 +3363,8 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int glBegin(GL_LINE_STRIP); for (i = 0; i < LINK_RESOL; ++i) { float t = (float)i / (float)(LINK_RESOL - 1); - glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]); + glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], + (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]); } glEnd(); } @@ -3337,6 +3374,7 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int /* restore previuos linewidth */ glLineWidth(linew); } +#endif /* note; this is used for fake links in groups too */ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) |