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:
authorThomas Dinges <blender@dingto.org>2015-11-18 19:12:26 +0300
committerThomas Dinges <blender@dingto.org>2015-11-18 19:12:26 +0300
commit38bbc920a60c39e18f866175563a63e834a10f5e (patch)
tree2c8f17e613d37d6cdd05d021e52d05c358e667af /intern/cycles/render/graph.cpp
parentc2c11debe5abf52afa46b99c6dc6a5acd12d97ae (diff)
Cycles: Add utility functions to get a ShaderInput / ShaderOutput by name.
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r--intern/cycles/render/graph.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index f5ff091623b..16e1ef7a493 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -117,6 +117,30 @@ ShaderOutput *ShaderNode::add_output(const char *name, ShaderSocketType type)
return output;
}
+ShaderInput *ShaderNode::get_input(const char *name)
+{
+ foreach(ShaderInput *input, inputs) {
+ if(input->name == name)
+ return input;
+ }
+
+ /* Should never happen. */
+ assert(!"No Shader Input!");
+ return NULL;
+}
+
+ShaderOutput *ShaderNode::get_output(const char *name)
+{
+ foreach(ShaderOutput *output, outputs) {
+ if(output->name == name)
+ return output;
+ }
+
+ /* Should never happen. */
+ assert(!"No Shader Output!");
+ return NULL;
+}
+
void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
foreach(ShaderInput *input, inputs) {