diff options
author | Fabian Schempp <fabianschempp@googlemail.com> | 2021-03-11 20:53:29 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2021-03-11 20:53:29 +0300 |
commit | afa30f1a9d2124f1e7d7e16cac8e1176a22029ed (patch) | |
tree | 2de954663ba08d95fe90935e5ea0575dc4102ad6 /source/blender/editors/space_node/node_draw.cc | |
parent | 8c6337e587bd2d738398474ce6068a748bd1b85b (diff) |
Nodes: Fix drag link from output to already linked Multi-Input Socket
This patch fixes a visual bug related to connecting an output socket to
a Multi-Input Socket, that already has a link to that same output.
In this case, the drag link got a new index and snapped to a new
position. This path makes the drag link snap to the same position as the
first link between the two sockets.
Differential Revision: https://developer.blender.org/D10689
Diffstat (limited to 'source/blender/editors/space_node/node_draw.cc')
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index bb0cd754c7b..f64ce771b25 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -37,6 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_map.hh" #include "BLI_math.h" +#include "BLI_set.hh" #include "BLI_span.hh" #include "BLI_string_ref.hh" #include "BLI_vector.hh" @@ -81,6 +82,7 @@ # include "COM_compositor.h" #endif +using blender::Set; using blender::Span; using blender::Vector; @@ -1746,10 +1748,11 @@ static void count_mutli_input_socket_links(bNodeTree *ntree, SpaceNode *snode) LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { LISTBASE_FOREACH (struct bNodeSocket *, socket, &node->inputs) { if (socket->flag & SOCK_MULTI_INPUT) { + Set<bNodeSocket *> visited_from_sockets; socket->total_inputs = 0; LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { if (link->tosock == socket) { - socket->total_inputs++; + visited_from_sockets.add(link->fromsock); } } /* Count temporary links going into this socket. */ @@ -1757,10 +1760,11 @@ static void count_mutli_input_socket_links(bNodeTree *ntree, SpaceNode *snode) LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { bNodeLink *link = (bNodeLink *)linkdata->data; if (link->tosock == socket) { - socket->total_inputs++; + visited_from_sockets.add(link->fromsock); } } } + socket->total_inputs = visited_from_sockets.size(); } } } |