diff options
author | Leon Schittek <lone_noel> | 2022-02-28 23:52:00 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-28 23:52:00 +0300 |
commit | 75bb99fa40dd09e4ae0e92cca9398b929f855a2c (patch) | |
tree | ebbb8fd315e9b9e6e7d94cfd2b64fb49dd1c0a31 /source/blender/editors/space_node/drawnode.cc | |
parent | eeb0279e890e7b021e0ac9dd48d2bcf6bef8300b (diff) |
Nodes: Improve readability of selected node links
This commit improves the drawing of selected node links:
- Highlight the entire link to make it easier to spot where the link
is going/coming from.
- Always draw selected links on top, so they are always clearly
visible.
- Don't fade selected node links when the sockets they are connected
to are out out view.
- Dragged node links still get a partial highlight when they are only
attached to one socket.
Differential Revision: https://developer.blender.org/D11930
Diffstat (limited to 'source/blender/editors/space_node/drawnode.cc')
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index b2c361ecaba..afb205f9f9e 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1967,9 +1967,10 @@ void node_draw_link_bezier(const bContext &C, const bNodeLink &link, const int th_col1, 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 dash_factor = 1.0f; @@ -2025,19 +2026,17 @@ void node_draw_link_bezier(const bContext &C, } /* Highlight links connected to selected nodes. */ - const bool is_fromnode_selected = link.fromnode && link.fromnode->flag & SELECT; - const bool is_tonode_selected = link.tonode && link.tonode->flag & SELECT; - if (is_fromnode_selected || is_tonode_selected) { + if (selected) { float color_selected[4]; UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected); const float alpha = color_selected[3]; /* Interpolate color if highlight color is not fully transparent. */ if (alpha != 0.0) { - if (is_fromnode_selected) { + if (link.fromsock) { 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); } } @@ -2102,7 +2101,8 @@ void node_draw_link_bezier(const bContext &C, void node_draw_link(const bContext &C, const View2D &v2d, 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; @@ -2146,7 +2146,7 @@ void node_draw_link(const bContext &C, } } - 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 |