diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-05 18:17:42 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-05 18:17:42 +0400 |
commit | f82c2d2cdc506b13f7fd0190a6d725f4e04cbbc1 (patch) | |
tree | 45481c531af7e0a3b14c2e7006aefcb78a3d2334 /source/blender/makesrna | |
parent | aaafb7c0cd055de36f24f53aa04a58ae84203030 (diff) |
Fix #30804: nodetree.links.new() incorrectly disconnected or allowed to connect
multiple links to a socket when the arguments were passed in order:
(input socket, output socket) instead of (output socket, input socket)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 53c2d1b847a..67d0c08a628 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -685,14 +685,14 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree) WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); } -static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, bNodeSocket *in, bNodeSocket *out) +static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, bNodeSocket *fromsock, bNodeSocket *tosock) { bNodeLink *ret; bNode *fromnode = NULL, *tonode = NULL; int from_in_out, to_in_out; - nodeFindNode(ntree, in, &fromnode, NULL, &from_in_out); - nodeFindNode(ntree, out, &tonode, NULL, &to_in_out); + nodeFindNode(ntree, fromsock, &fromnode, NULL, &from_in_out); + nodeFindNode(ntree, tosock, &tonode, NULL, &to_in_out); if (&from_in_out == &to_in_out) { BKE_reportf(reports, RPT_ERROR, "Same input/output direction of sockets"); @@ -700,9 +700,12 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b } /* unlink node input socket */ - nodeRemSocketLinks(ntree, out); + if (to_in_out == SOCK_IN) + nodeRemSocketLinks(ntree, tosock); + else + nodeRemSocketLinks(ntree, fromsock); - ret = nodeAddLink(ntree, fromnode, in, tonode, out); + ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); if (ret) { nodeUpdate(ntree, tonode); @@ -711,6 +714,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); } + return ret; } |