diff options
author | Leon Schittek <lone_noel> | 2022-02-28 23:52:00 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2022-04-11 01:30:21 +0300 |
commit | 2d07099ed61c71120e638234280bcdc79787e1ca (patch) | |
tree | cb99ba90cfd3ecd8e36e0d8441f9b8d521b919d8 /source/blender/editors/space_node/node_draw.cc | |
parent | 0d570d07e0679907222834964895ecf9c89e08e1 (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/node_draw.cc')
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 7f3bc8ccb13..7b4578e6c05 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -660,7 +660,7 @@ static void node_draw_mute_line(const bContext &C, GPU_blend(GPU_BLEND_ALPHA); LISTBASE_FOREACH (const bNodeLink *, link, &node.internal_links) { - node_draw_link_bezier(C, v2d, snode, *link, TH_WIRE_INNER, TH_WIRE_INNER, TH_WIRE); + node_draw_link_bezier(C, v2d, snode, *link, TH_WIRE_INNER, TH_WIRE_INNER, TH_WIRE, false); } GPU_blend(GPU_BLEND_NONE); @@ -2650,10 +2650,18 @@ static void node_draw_nodetree(const bContext &C, nodelink_batch_start(snode); LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) { - if (!nodeLinkIsHidden(link)) { - node_draw_link(C, region.v2d, snode, *link); + if (!nodeLinkIsHidden(link) && !nodeLinkIsSelected(link)) { + node_draw_link(C, region.v2d, snode, *link, false); } } + + /* Draw selected node links after the unselected ones, so they are shown on top. */ + LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) { + if (!nodeLinkIsHidden(link) && nodeLinkIsSelected(link)) { + node_draw_link(C, region.v2d, snode, *link, true); + } + } + nodelink_batch_end(snode); GPU_blend(GPU_BLEND_NONE); @@ -2838,7 +2846,7 @@ void node_draw_space(const bContext &C, ARegion ®ion) GPU_line_smooth(true); if (snode.runtime->linkdrag) { for (const bNodeLink *link : snode.runtime->linkdrag->links) { - node_draw_link(C, v2d, snode, *link); + node_draw_link(C, v2d, snode, *link, true); } } GPU_line_smooth(false); |