From e44fa4e6a9ec839f1ee2abca785261ecc78dff2b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 21 Jul 2016 04:38:55 +0200 Subject: [PATCH] Fix another Cycles OSL script node issue with shaders using bump. --- intern/cycles/render/graph.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index ac78238dfee..66601fa3502 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -374,24 +374,12 @@ void ShaderGraph::copy_nodes(ShaderNodeSet& nodes, ShaderNodeMap& nnodemap) ShaderNode *nnode = node->clone(); nnodemap[node] = nnode; + /* create new inputs and outputs to recreate links and ensure + * that we still point to valid SocketType if the NodeType + * changed in cloning, as it does for OSL nodes */ nnode->inputs.clear(); nnode->outputs.clear(); - - foreach(ShaderInput *input, node->inputs) { - ShaderInput *ninput = new ShaderInput(*input); - nnode->inputs.push_back(ninput); - - ninput->parent = nnode; - ninput->link = NULL; - } - - foreach(ShaderOutput *output, node->outputs) { - ShaderOutput *noutput = new ShaderOutput(*output); - nnode->outputs.push_back(noutput); - - noutput->parent = nnode; - noutput->links.clear(); - } + nnode->create_inputs_outputs(nnode->type); } /* recreate links */