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.

This commit is contained in:
Lukas Toenne 2013-03-20 09:53:29 +00:00
parent 08a7b607f7
commit 3f1034c2b1

@ -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);
}