Fix T98247 EEVEE: Regression: Shader To RGB not displaying textures

This was caused by the nodetree branch duplication not handling incoming
links to the copied node, making all bsdfs nodes use their default values.
This commit is contained in:
2022-05-24 10:35:17 +02:00
parent 174c3ffb4a
commit ec5b53a018

View File

@@ -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);