[Bf-blender-cvs] [07fa016] master: Fix T40282: Renaming node sockets in Cycles nodes causes crash.

Lukas Tönne noreply at git.blender.org
Fri Jun 6 09:35:06 CEST 2014


Commit: 07fa016d9777a27b79f2003fb6d9db28db349e40
Author: Lukas Tönne
Date:   Fri Jun 6 09:25:05 2014 +0200
https://developer.blender.org/rB07fa016d9777a27b79f2003fb6d9db28db349e40

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.

===================================================================

M	intern/cycles/blender/blender_shader.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index ddbb40d..379e27c 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;
 				}
 			}




More information about the Bf-blender-cvs mailing list