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-08 01:41:01 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-08 21:21:04 +0300
commita815e1021162b4c0f7c622e180f6283d8cf05e07 (patch)
tree9b7fd29428fb95137e06eda193a15f47aad3de83
parentdfe9aa25c366484076a93bf52b65d0f434c72c27 (diff)
Code cleanup: use special type instead of node names.
-rw-r--r--intern/cycles/render/graph.cpp2
-rw-r--r--intern/cycles/render/graph.h2
-rw-r--r--intern/cycles/render/nodes.cpp6
-rw-r--r--intern/cycles/render/osl.cpp2
-rw-r--r--intern/cycles/render/svm.cpp2
5 files changed, 11 insertions, 3 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index b23fd2a7a8b..920f5c7b50d 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -910,7 +910,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
* avoid building a closure tree and then flattening it, and instead write it
* directly to an array */
- if(node->name == ustring("mix_closure") || node->name == ustring("add_closure")) {
+ if(node->special_type == SHADER_SPECIAL_TYPE_COMBINE_CLOSURE) {
ShaderInput *fin = node->input("Fac");
ShaderInput *cl1in = node->input("Closure1");
ShaderInput *cl2in = node->input("Closure2");
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index 2236f51957c..6619fcaebeb 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -81,6 +81,8 @@ enum ShaderNodeSpecialType {
SHADER_SPECIAL_TYPE_SCRIPT,
SHADER_SPECIAL_TYPE_IMAGE_SLOT,
SHADER_SPECIAL_TYPE_CLOSURE,
+ SHADER_SPECIAL_TYPE_COMBINE_CLOSURE,
+ SHADER_SPECIAL_TYPE_OUTPUT,
SHADER_SPECIAL_TYPE_BUMP,
};
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index c1841f310b5..49d53def7a9 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -3126,6 +3126,8 @@ void ColorNode::compile(OSLCompiler& compiler)
AddClosureNode::AddClosureNode()
: ShaderNode("add_closure")
{
+ special_type = SHADER_SPECIAL_TYPE_COMBINE_CLOSURE;
+
add_input("Closure1", SHADER_SOCKET_CLOSURE);
add_input("Closure2", SHADER_SOCKET_CLOSURE);
add_output("Closure", SHADER_SOCKET_CLOSURE);
@@ -3146,6 +3148,8 @@ void AddClosureNode::compile(OSLCompiler& compiler)
MixClosureNode::MixClosureNode()
: ShaderNode("mix_closure")
{
+ special_type = SHADER_SPECIAL_TYPE_COMBINE_CLOSURE;
+
add_input("Fac", SHADER_SOCKET_FLOAT, 0.5f);
add_input("Closure1", SHADER_SOCKET_CLOSURE);
add_input("Closure2", SHADER_SOCKET_CLOSURE);
@@ -3963,6 +3967,8 @@ void BlackbodyNode::compile(OSLCompiler& compiler)
OutputNode::OutputNode()
: ShaderNode("output")
{
+ special_type = SHADER_SPECIAL_TYPE_OUTPUT;
+
add_input("Surface", SHADER_SOCKET_CLOSURE);
add_input("Volume", SHADER_SOCKET_CLOSURE);
add_input("Displacement", SHADER_SOCKET_FLOAT);
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 964ed8db3f7..78215af8375 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -473,7 +473,7 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
if(!(input->usage & ShaderInput::USE_OSL))
return true;
- if(node->name == ustring("output")) {
+ if(node->special_type == SHADER_SPECIAL_TYPE_OUTPUT) {
if(strcmp(input->name, "Surface") == 0 && current_type != SHADER_TYPE_SURFACE)
return true;
if(strcmp(input->name, "Volume") == 0 && current_type != SHADER_TYPE_VOLUME)
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index a96650c2afc..8f23a1f5ac9 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -506,7 +506,7 @@ void SVMCompiler::generate_multi_closure(ShaderNode *root_node,
state->closure_done.insert(node);
- if(node->name == ustring("mix_closure") || node->name == ustring("add_closure")) {
+ if(node->special_type == SHADER_SPECIAL_TYPE_COMBINE_CLOSURE) {
/* weighting is already taken care of in ShaderGraph::transform_multi_closure */
ShaderInput *cl1in = node->input("Closure1");
ShaderInput *cl2in = node->input("Closure2");