diff options
author | Hans Goudey <h.goudey@me.com> | 2021-04-07 08:32:16 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-04-07 08:32:16 +0300 |
commit | 2fbee4598cb7ba0430bf16a0ebb9ec9fabacf42d (patch) | |
tree | a3763a4c362c38855f64e08b0ccdbefaf0fa07b0 /source/blender/nodes | |
parent | fd0a0096dd07c7672d82ca91d5edd5315c2a2c5f (diff) |
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.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/intern/node_util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index 3289caad9ba..4076dc852b3 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -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); |