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:
authorJacques Lucke <jacques@blender.org>2021-06-14 11:04:32 +0300
committerJacques Lucke <jacques@blender.org>2021-06-14 11:04:52 +0300
commit03544ed54f8dc5fb28d2c6b655a4153286c0137f (patch)
tree705aeb0a47096ab2315c507b55c9417c0a016b5f /source/blender/makesrna
parent54a03d4247ccde0f6c46707e9c91bebfb76e08bc (diff)
Fix T88807: crash when there are multiple links between the same sockets
This commit does two things: * Disallows creating more than one link from one socket to a multi socket input. * Properly count links if there happen to be more than one link between the same sockets. The new link counting should also be more efficient asymptotically. Differential Revision: https://developer.blender.org/D11570
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index b625f0fc204..2a1ea3d6716 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1283,6 +1283,13 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
if (nodeCountSocketLinks(ntree, tosock) + 1 > nodeSocketLinkLimit(tosock)) {
nodeRemSocketLinks(ntree, tosock);
}
+ if (tosock->flag & SOCK_MULTI_INPUT) {
+ LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
+ if (link->fromsock == fromsock && link->tosock == tosock) {
+ nodeRemLink(ntree, link);
+ }
+ }
+ }
}
ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);