Fix T87195: Boolean node multi-input socket only accepts one link

The default insert link callback for nodes was trying to move the
existing link away, since it didn't properly handle multi-input sockets
(though the problem wasn't exposed for the join node). We can basically
skip all of this "moving existing links" for multi-input sockets, unless
we are at the link limit.
This commit is contained in:
Hans Goudey 2021-04-07 00:32:16 -05:00
parent fd0a0096dd
commit 2fbee4598c
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by issue #87195, Multi-input socket on boolean node only accepts single input
1 changed files with 7 additions and 0 deletions

View File

@ -310,6 +310,13 @@ void node_insert_link_default(bNodeTree *ntree, bNode *node, bNodeLink *link)
return;
}
/* If we're not at the link limit of the target socket, we can skip
* trying to move existing links to another socket. */
const int to_link_limit = nodeSocketLinkLimit(socket);
if (socket->total_inputs + 1 < to_link_limit) {
return;
}
LISTBASE_FOREACH_MUTABLE (bNodeLink *, to_link, &ntree->links) {
if (socket == to_link->tosock) {
bNodeSocket *new_socket = node_find_linkable_socket(ntree, node, socket);