[Bf-blender-cvs] [37570a73170] blender-v2.93-release: Fix T87360 Multi input links aren't placed correctly when created with python
Fabian Schempp
noreply at git.blender.org
Thu May 13 23:05:42 CEST 2021
Commit: 37570a73170e6cddc32ed0523b626bf0857cf068
Author: Fabian Schempp
Date: Thu May 13 23:05:38 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB37570a73170e6cddc32ed0523b626bf0857cf068
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
===================================================================
M source/blender/blenkernel/intern/node.cc
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list