From 07fa016d9777a27b79f2003fb6d9db28db349e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Fri, 6 Jun 2014 09:25:05 +0200 Subject: [PATCH] Fix T40282: Renaming node sockets in Cycles nodes causes crash. Cycles expects to find all node sockets with their correct names, but this can be changed via the API (see bug report discussion). Solution for now is to let cycles accept this case gracefully instead of crashing. The shader will simply use the internal default values for inputs and any connections will be ignored. Would be nice to report the error somewhere, but cycles doesn't have a proper logging system for this purpose yet. --- intern/cycles/blender/blender_shader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index ddbb40da7db..379e27c558c 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -880,12 +880,20 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha /* map node sockets for linking */ for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) { ShaderInput *input = node_find_input_by_name(node, *b_node, *b_input); + if (!input) { + /* XXX should not happen, report error? */ + continue; + } input_map[b_input->ptr.data] = input; set_default_value(input, *b_node, *b_input, b_data, b_ntree); } for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) { ShaderOutput *output = node_find_output_by_name(node, *b_node, *b_output); + if (!output) { + /* XXX should not happen, report error? */ + continue; + } output_map[b_output->ptr.data] = output; } }