From ec5b53a01806465a08ca56a4dcd18092d29d66c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 24 May 2022 10:35:17 +0200 Subject: 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. --- source/blender/nodes/shader/node_shader_tree.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/nodes') 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); -- cgit v1.2.3