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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user