Fix T47729: Linking node sockets using shortcut fails

Could also have swapped nodes to assign instead of swapping after assigning, but this way it's easier to see whats going on.
This commit is contained in:
Julian Eisel 2016-03-09 11:23:56 +01:00
parent 5704ba7f9b
commit 2f3e39869a
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by issue #47729, Failed linking node sockets by Shortcut
1 changed files with 4 additions and 0 deletions

View File

@ -274,6 +274,10 @@ static void snode_autoconnect(SpaceNode *snode, const bool allow_multiple, const
node_fr = nli->node;
node_to = nli->next->node;
/* corner case: input/output node aligned the wrong way around (T47729) */
if (BLI_listbase_is_empty(&node_to->inputs) || BLI_listbase_is_empty(&node_fr->outputs)) {
SWAP(bNode *, node_fr, node_to);
}
/* if there are selected sockets, connect those */
for (sock_to = node_to->inputs.first; sock_to; sock_to = sock_to->next) {