From 3f1034c2b1643e9abb87abf041221b4590b060c6 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 20 Mar 2013 09:53:29 +0000 Subject: [PATCH] Fix for bug reported on bf-committers: RNA function nodetree.links.new does not remove existing links when connecting to a linked input. The check for socket connection limits was 1 off, needs to add 1 to the link counter to anticipate the newly added link. --- source/blender/makesrna/intern/rna_nodetree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 9f42da0c702..45a81e1a2ab 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -829,9 +829,9 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, if (verify_limits) { /* remove other socket links if limit is exceeded */ - if (nodeCountSocketLinks(ntree, fromsock) > fromsock->limit) + if (nodeCountSocketLinks(ntree, fromsock) + 1 > fromsock->limit) nodeRemSocketLinks(ntree, fromsock); - if (nodeCountSocketLinks(ntree, tosock) > tosock->limit) + if (nodeCountSocketLinks(ntree, tosock) + 1 > tosock->limit) nodeRemSocketLinks(ntree, tosock); }