Revision: 36616 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36616 Author: lukastoenne Date: 2011-05-11 14:28:56 +0000 (Wed, 11 May 2011) Log Message: ----------- Fixed initialization of constant values in Value and RGB input nodes.
Modified Paths: -------------- branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_rgb.c branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_value.c branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_rgb.c branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_value.c Modified: branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_rgb.c =================================================================== --- branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_rgb.c 2011-05-11 14:05:22 UTC (rev 36615) +++ branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_rgb.c 2011-05-11 14:28:56 UTC (rev 36616) @@ -41,6 +41,17 @@ { -1, 0, "" } }; +static void node_composit_init_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +{ + bNodeSocket *sock= node->outputs.first; + float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value; + /* uses the default value of the output socket, must be initialized here */ + col[0] = 0.5f; + col[1] = 0.5f; + col[2] = 0.5f; + col[3] = 1.0f; +} + static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; @@ -55,6 +66,7 @@ node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out); + node_type_init(&ntype, node_composit_init_rgb); node_type_size(&ntype, 140, 80, 140); node_type_exec(&ntype, node_composit_exec_rgb); Modified: branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_value.c =================================================================== --- branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_value.c 2011-05-11 14:05:22 UTC (rev 36615) +++ branches/particles-2010/source/blender/nodes/composite/nodes/node_composite_value.c 2011-05-11 14:28:56 UTC (rev 36616) @@ -40,6 +40,14 @@ { -1, 0, "" } }; +static void node_composit_init_value(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +{ + bNodeSocket *sock= node->outputs.first; + bNodeSocketValueFloat *dval= (bNodeSocketValueFloat*)sock->default_value; + /* uses the default value of the output socket, must be initialized here */ + dval->value = 0.5f; +} + static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; @@ -54,6 +62,7 @@ node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_value_out); + node_type_init(&ntype, node_composit_init_value); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, node_composit_exec_value); Modified: branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_rgb.c =================================================================== --- branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_rgb.c 2011-05-11 14:05:22 UTC (rev 36615) +++ branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_rgb.c 2011-05-11 14:28:56 UTC (rev 36616) @@ -40,6 +40,17 @@ { -1, 0, "" } }; +static void node_shader_init_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +{ + bNodeSocket *sock= node->outputs.first; + bNodeSocketValueRGBA *dval= (bNodeSocketValueRGBA*)sock->default_value; + /* uses the default value of the output socket, must be initialized here */ + dval->value[0] = 0.5f; + dval->value[1] = 0.5f; + dval->value[2] = 0.5f; + dval->value[3] = 1.0f; +} + static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; @@ -63,6 +74,7 @@ node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, sh_node_rgb_out); + node_type_init(&ntype, node_shader_init_rgb); node_type_size(&ntype, 140, 80, 140); node_type_exec(&ntype, node_shader_exec_rgb); node_type_gpu(&ntype, gpu_shader_rgb); Modified: branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_value.c =================================================================== --- branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_value.c 2011-05-11 14:05:22 UTC (rev 36615) +++ branches/particles-2010/source/blender/nodes/shader/nodes/node_shader_value.c 2011-05-11 14:28:56 UTC (rev 36616) @@ -40,6 +40,14 @@ { -1, 0, "" } }; +static void node_shader_init_value(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) +{ + bNodeSocket *sock= node->outputs.first; + bNodeSocketValueFloat *dval= (bNodeSocketValueFloat*)sock->default_value; + /* uses the default value of the output socket, must be initialized here */ + dval->value = 0.5f; +} + static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; @@ -63,6 +71,7 @@ node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, sh_node_value_out); + node_type_init(&ntype, node_shader_init_value); node_type_size(&ntype, 80, 50, 120); node_type_exec(&ntype, node_shader_exec_value); node_type_gpu(&ntype, gpu_shader_value); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs