Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/drawnode.cc
| Show First 20 Lines • Show All 1,961 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void node_draw_link_bezier(const bContext &C, | void node_draw_link_bezier(const bContext &C, | ||||
| const View2D &v2d, | const View2D &v2d, | ||||
| const SpaceNode &snode, | const SpaceNode &snode, | ||||
| const bNodeLink &link, | const bNodeLink &link, | ||||
| const int th_col1, | const int th_col1, | ||||
| const int th_col2, | const int th_col2, | ||||
| const int th_col3) | const int th_col3, | ||||
| const bool selected) | |||||
| { | { | ||||
| const float dim_factor = node_link_dim_factor(v2d, link); | const float dim_factor = selected ? 1.0f : node_link_dim_factor(v2d, link); | ||||
| float thickness = 1.5f; | float thickness = 1.5f; | ||||
| float dash_factor = 1.0f; | float dash_factor = 1.0f; | ||||
| bTheme *btheme = UI_GetTheme(); | bTheme *btheme = UI_GetTheme(); | ||||
| const float dash_alpha = btheme->space_node.dash_alpha; | const float dash_alpha = btheme->space_node.dash_alpha; | ||||
| if (snode.edittree->type == NTREE_GEOMETRY) { | if (snode.edittree->type == NTREE_GEOMETRY) { | ||||
| if (link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) { | if (link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) { | ||||
| Show All 39 Lines | if (snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS && | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| UI_GetThemeColor4fv(th_col1, colors[1]); | UI_GetThemeColor4fv(th_col1, colors[1]); | ||||
| UI_GetThemeColor4fv(th_col2, colors[2]); | UI_GetThemeColor4fv(th_col2, colors[2]); | ||||
| } | } | ||||
| /* Highlight links connected to selected nodes. */ | /* Highlight links connected to selected nodes. */ | ||||
| const bool is_fromnode_selected = link.fromnode && link.fromnode->flag & SELECT; | if (selected) { | ||||
| const bool is_tonode_selected = link.tonode && link.tonode->flag & SELECT; | |||||
| if (is_fromnode_selected || is_tonode_selected) { | |||||
| float color_selected[4]; | float color_selected[4]; | ||||
| UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected); | UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected); | ||||
| const float alpha = color_selected[3]; | const float alpha = color_selected[3]; | ||||
| /* Interpolate color if highlight color is not fully transparent. */ | /* Interpolate color if highlight color is not fully transparent. */ | ||||
| if (alpha != 0.0) { | if (alpha != 0.0) { | ||||
| if (is_fromnode_selected) { | if (link.fromsock) { | ||||
| interp_v3_v3v3(colors[1], colors[1], color_selected, alpha); | interp_v3_v3v3(colors[1], colors[1], color_selected, alpha); | ||||
| } | } | ||||
| if (is_tonode_selected) { | if (link.tosock) { | ||||
| interp_v3_v3v3(colors[2], colors[2], color_selected, alpha); | interp_v3_v3v3(colors[2], colors[2], color_selected, alpha); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (g_batch_link.enabled && !highlighted) { | if (g_batch_link.enabled && !highlighted) { | ||||
| /* Add link to batch. */ | /* Add link to batch. */ | ||||
| nodelink_batch_add_link(snode, | nodelink_batch_add_link(snode, | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | else { | ||||
| GPU_uniformbuf_free(ubo); | GPU_uniformbuf_free(ubo); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void node_draw_link(const bContext &C, | void node_draw_link(const bContext &C, | ||||
| const View2D &v2d, | const View2D &v2d, | ||||
| const SpaceNode &snode, | const SpaceNode &snode, | ||||
| const bNodeLink &link) | const bNodeLink &link, | ||||
| const bool selected) | |||||
| { | { | ||||
| int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE; | int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE; | ||||
| if (link.fromsock == nullptr && link.tosock == nullptr) { | if (link.fromsock == nullptr && link.tosock == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* new connection */ | /* new connection */ | ||||
| Show All 27 Lines | void node_draw_link(const bContext &C, | ||||
| /* Links from field to non-field sockets are not allowed. */ | /* Links from field to non-field sockets are not allowed. */ | ||||
| if (snode.edittree->type == NTREE_GEOMETRY && !(link.flag & NODE_LINK_DRAGGED)) { | if (snode.edittree->type == NTREE_GEOMETRY && !(link.flag & NODE_LINK_DRAGGED)) { | ||||
| if ((link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) && | if ((link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) && | ||||
| (link.tosock && link.tosock->display_shape == SOCK_DISPLAY_SHAPE_CIRCLE)) { | (link.tosock && link.tosock->display_shape == SOCK_DISPLAY_SHAPE_CIRCLE)) { | ||||
| th_col1 = th_col2 = th_col3 = TH_REDALERT; | th_col1 = th_col2 = th_col3 = TH_REDALERT; | ||||
| } | } | ||||
| } | } | ||||
| node_draw_link_bezier(C, v2d, snode, link, th_col1, th_col2, th_col3); | node_draw_link_bezier(C, v2d, snode, link, th_col1, th_col2, th_col3, selected); | ||||
| } | } | ||||
| } // namespace blender::ed::space_node | } // namespace blender::ed::space_node | ||||
| void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos) | void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos) | ||||
| { | { | ||||
| immBegin(GPU_PRIM_LINES, 4); | immBegin(GPU_PRIM_LINES, 4); | ||||
| Show All 20 Lines | |||||