diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-06-06 11:25:05 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-06-06 11:28:26 +0400 |
commit | 07fa016d9777a27b79f2003fb6d9db28db349e40 (patch) | |
tree | 9a23cc54cfbf8e50c614926ceaa22fac1094addc /intern | |
parent | 96f81242bdbd24bdf1bbb6e2a5bc0de91339df5e (diff) |
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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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; } } |