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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-29 14:26:41 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-29 21:30:16 +0300
commitaf073e149b3c734f70bb13f20a4e18682885342e (patch)
treecc750c91ae084be0913ba39a6d7691d3b7cadeef /intern/cycles/render/graph.cpp
parent9bd2820aaf599bb25a19cdb6b548957b6686eadc (diff)
Code refactor: pass ShaderInput to constant_fold, so it supports arbitrary types.
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r--intern/cycles/render/graph.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 62998b0166f..29c0eec9b97 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -470,8 +470,8 @@ void ShaderGraph::remove_proxy_nodes()
disconnect(to);
/* transfer the default input value to the target socket */
- to->value() = input->value();
- to->value_string() = input->value_string();
+ to->set(input->value());
+ to->set(input->value_string());
}
}
@@ -537,14 +537,13 @@ void ShaderGraph::constant_fold()
}
}
/* Optimize current node. */
- float3 optimized_value = make_float3(0.0f, 0.0f, 0.0f);
- if(node->constant_fold(this, output, &optimized_value)) {
- /* Apply optimized value to connected sockets. */
+ if(node->constant_fold(this, output, output->links[0])) {
+ /* Apply optimized value to other connected sockets and disconnect. */
vector<ShaderInput*> links(output->links);
- foreach(ShaderInput *input, links) {
- /* Assign value and disconnect the optimizedinput. */
- input->value() = optimized_value;
- disconnect(input);
+ for(size_t i = 0; i < links.size(); i++) {
+ if(i > 0)
+ links[i]->set(links[0]->value());
+ disconnect(links[i]);
}
}
}
@@ -935,7 +934,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
if(fin->link)
connect(fin->link, fac_in);
else
- fac_in->value_float() = fin->value_float();
+ fac_in->set(fin->value_float());
if(weight_out)
connect(weight_out, weight_in);
@@ -970,12 +969,12 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
if(weight_in->link)
connect(weight_in->link, value1_in);
else
- value1_in->value() = weight_in->value();
+ value1_in->set(weight_in->value_float());
if(weight_out)
connect(weight_out, value2_in);
else
- value2_in->value_float() = 1.0f;
+ value2_in->set(1.0f);
weight_out = math_node->output("Value");
if(weight_in->link)
@@ -986,7 +985,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
if(weight_out)
connect(weight_out, weight_in);
else
- weight_in->value_float() += 1.0f;
+ weight_in->set(weight_in->value_float() + 1.0f);
}
}