Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Schempp <fabianschempp@googlemail.com>2021-03-11 20:53:29 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-03-11 20:53:29 +0300
commitafa30f1a9d2124f1e7d7e16cac8e1176a22029ed (patch)
tree2de954663ba08d95fe90935e5ea0575dc4102ad6 /source/blender/editors/space_node/node_relationships.c
parent8c6337e587bd2d738398474ce6068a748bd1b85b (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_relationships.c')
-rw-r--r--source/blender/editors/space_node/node_relationships.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 963349f876b..9293494a16a 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -890,10 +890,24 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
continue;
}
+ /* Skip if tsock is already linked with this output. */
+ bNodeLink *existing_link_connected_to_fromsock = NULL;
+ LISTBASE_FOREACH (bNodeLink *, existing_link, &snode->edittree->links) {
+ if (existing_link->fromsock == link->fromsock && existing_link->tosock == tsock) {
+ existing_link_connected_to_fromsock = existing_link;
+ break;
+ }
+ }
+
/* attach links to the socket */
link->tonode = tnode;
link->tosock = tsock;
snode->runtime->last_node_hovered_while_dragging_a_link = tnode;
+ if (existing_link_connected_to_fromsock) {
+ link->multi_input_socket_index =
+ existing_link_connected_to_fromsock->multi_input_socket_index;
+ continue;
+ }
sort_multi_input_socket_links(snode, tnode, link, cursor);
}
}