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
path: root/source
diff options
context:
space:
mode:
authorFabian Schempp <fabianschempp@googlemail.com>2021-05-14 00:05:38 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-05-14 00:05:38 +0300
commit37570a73170e6cddc32ed0523b626bf0857cf068 (patch)
treed8c323e46d7a58c7701063fdbdbf8e8faf3de5fd /source
parent5368859a669d8cd606a6ae6948f9c927ff8faf4d (diff)
Fix T87360 Multi input links aren't placed correctly when created with python
link->multi_input_socket_index, which is used to calculate the links position on the multi-input socket, was not set. Now it is set to the sockets current link count. Review: Jacques Lucke (JacquesLucke) Differential Revision: https://developer.blender.org/D11082
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/node.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 02195e0d60f..cf5f7163c17 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -2172,6 +2172,17 @@ bNodeTree *ntreeCopyTree_ex_new_pointers(const bNodeTree *ntree,
return new_ntree;
}
+static int node_count_links(const bNodeTree *ntree, const bNodeSocket *socket)
+{
+ int count = 0;
+ LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
+ if (ELEM(socket, link->fromsock, link->tosock)) {
+ count++;
+ }
+ }
+ return count;
+}
+
/* also used via rna api, so we check for proper input output direction */
bNodeLink *nodeAddLink(
bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
@@ -2208,6 +2219,10 @@ bNodeLink *nodeAddLink(
ntree->update |= NTREE_UPDATE_LINKS;
}
+ if(link->tosock->flag & SOCK_MULTI_INPUT){
+ link->multi_input_socket_index = node_count_links(ntree,link->tosock) - 1;
+ }
+
return link;
}