diff options
author | Leon Schittek <leon.schittek@gmx.net> | 2022-04-18 23:28:03 +0300 |
---|---|---|
committer | Leon Schittek <leon.schittek@gmx.net> | 2022-04-18 23:28:03 +0300 |
commit | 03d39a04a3a29b7eb464ca2ae39c69757ee9f6c2 (patch) | |
tree | 739c4608eda314fa8ac03b5fa2f94eccd2c9bfc5 /source/blender | |
parent | 314b27850ccb6d103cf5c73855187cfc11ec48d8 (diff) |
Fix T97002: Preserve multi socket link order
Preserve multi socket link order when copying nodes or adding a new
group input sockets by linking directly to multi inputs from the group
input node's extension socket.
This is done by also copying the `multi_input_socket_index` when
the new links are created by copying existing or temporary links.
Reviewed By: Hans Goudey
Differential Revision: http://developer.blender.org/D14535
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_node/node_edit.cc | 5 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_common.cc | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 9d83f977fe0..2d7972e2291 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -1306,6 +1306,11 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) newlink->flag = link->flag; newlink->tonode = node_map.lookup(link->tonode); newlink->tosock = socket_map.lookup(link->tosock); + + if (link->tosock->flag & SOCK_MULTI_INPUT) { + newlink->multi_input_socket_index = link->multi_input_socket_index; + } + if (link->fromnode && (link->fromnode->flag & NODE_SELECT)) { newlink->fromnode = node_map.lookup(link->fromnode); newlink->fromsock = socket_map.lookup(link->fromsock); diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index c4befd5828c..abbfe4b823d 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -476,7 +476,10 @@ void node_group_input_update(bNodeTree *ntree, bNode *node) /* redirect links from the extension socket */ for (link = (bNodeLink *)tmplinks.first; link; link = link->next) { - nodeAddLink(ntree, node, newsock, link->tonode, link->tosock); + bNodeLink *newlink = nodeAddLink(ntree, node, newsock, link->tonode, link->tosock); + if (newlink->tosock->flag & SOCK_MULTI_INPUT) { + newlink->multi_input_socket_index = link->multi_input_socket_index; + } } } |