diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-03-07 20:03:20 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-03-07 20:03:58 +0300 |
commit | b38b0cdb0dc3604c3ec2d7627897ba595de44646 (patch) | |
tree | be992e23e47bc5c7441577001b5fb1e301717669 /source/blender/nodes/shader | |
parent | 1eea4b2634954cc5f106bf759fa422e34c4c228d (diff) |
Fix T62305: Unconnected group vector inputs are mapped incorrectly
The issue was that `bNodeSocketValueVector` and `bNodeSocketValueRGBA`
don't store the value at the same location in the struct.
I kept the cases for `SOCK_VECTOR` and `SOCK_RGBA` completely separate
for now, because they only share code by coincidence and not because
they are actually the same. Eventually there could be a "Vector Input"
node similar to the "RGB" node.
Reviewers: fclem
Differential Revision: https://developer.blender.org/D4472
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r-- | source/blender/nodes/shader/node_shader_tree.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index f0fa49ed468..30cc9d512f7 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -445,6 +445,7 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree) { bNode *value_node, *group_node; bNodeSocket *value_socket; + bNodeSocketValueVector *src_vector; bNodeSocketValueRGBA *src_rgba, *dst_rgba; bNodeSocketValueFloat *src_float, *dst_float; bool link_added = false; @@ -468,6 +469,14 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree) switch (group_socket->type) { case SOCK_VECTOR: + value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB); + value_socket = ntree_shader_node_find_output(value_node, "Color"); + BLI_assert(value_socket != NULL); + src_vector = group_socket->default_value; + dst_rgba = value_socket->default_value; + copy_v3_v3(dst_rgba->value, src_vector->value); + dst_rgba->value[3] = 1.0f; /* should never be read */ + break; case SOCK_RGBA: value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB); value_socket = ntree_shader_node_find_output(value_node, "Color"); |