Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-10-08 14:03:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-10-08 14:05:51 +0300
commit1730c3666fd8a042a74100697fce00cc3e04a636 (patch)
treec580a750ad48bcb8f9f546b707fe5c055daecd54 /intern/cycles/blender/blender_shader.cpp
parentfca1d14214dd12b722c7862b698f43c843474795 (diff)
Fix T46406: Cycles ignores default socket value associated with group socket
Diffstat (limited to 'intern/cycles/blender/blender_shader.cpp')
-rw-r--r--intern/cycles/blender/blender_shader.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 17fcf03d866..fe6289018b2 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -107,8 +107,15 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket b_socket)
}
}
-static void set_default_value(ShaderInput *input, BL::NodeSocket b_sock, BL::BlendData b_data, BL::ID b_id)
+template <class SocketType>
+static void set_default_value(ShaderInput *input,
+ SocketType b_sock,
+ BL::BlendData b_data,
+ BL::ID b_id)
{
+ /* TODO(sergey): Use static assert to check SocketType is either BL::NodeSocket
+ * or BL::NodeSocketInterface.
+ */
/* copy values for non linked inputs */
switch(input->type) {
case SHADER_SOCKET_FLOAT: {
@@ -911,7 +918,8 @@ static void add_nodes(Scene *scene,
* Do this even if the node group has no internal tree,
* so that links have something to connect to and assert won't fail.
*/
- for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
+ int input_index = 0;
+ for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input, ++input_index) {
ProxyNode *proxy = new ProxyNode(convert_socket_type(*b_input));
graph->add(proxy);
@@ -920,7 +928,11 @@ static void add_nodes(Scene *scene,
input_map[b_input->ptr.data] = proxy->inputs[0];
- set_default_value(proxy->inputs[0], *b_input, b_data, b_ntree);
+ /* Use default value from corresponding socket interface since it's
+ * not copied from group to actual group node.
+ */
+ BL::NodeSocketInterface socket_interface = b_group_ntree.inputs[input_index];
+ set_default_value(proxy->inputs[0], socket_interface, b_data, b_ntree);
}
for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
ProxyNode *proxy = new ProxyNode(convert_socket_type(*b_output));