diff options
Diffstat (limited to 'source/blender/nodes/shader/node_shader_tree.cc')
-rw-r--r-- | source/blender/nodes/shader/node_shader_tree.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc index c5f40a46ca3..ec97637ccd2 100644 --- a/source/blender/nodes/shader/node_shader_tree.cc +++ b/source/blender/nodes/shader/node_shader_tree.cc @@ -587,10 +587,11 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree, } } } - /* Recreate links between copied nodes. */ + /* Recreate links between copied nodes AND incomming links to the copied nodes. */ LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { - if (link->fromnode->tmp_flag >= 0 && link->tonode->tmp_flag >= 0) { - bNode *fromnode = nodes_copy[link->fromnode->tmp_flag]; + if (link->tonode->tmp_flag >= 0) { + bool from_node_copied = link->fromnode->tmp_flag >= 0; + bNode *fromnode = from_node_copied ? nodes_copy[link->fromnode->tmp_flag] : link->fromnode; bNode *tonode = nodes_copy[link->tonode->tmp_flag]; bNodeSocket *fromsock = ntree_shader_node_find_output(fromnode, link->fromsock->identifier); bNodeSocket *tosock = ntree_shader_node_find_input(tonode, link->tosock->identifier); |