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) { diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h index 9117fd03a95..8169e606f1a 100644 --- a/intern/cycles/render/graph.h +++ b/intern/cycles/render/graph.h @@ -189,6 +189,9 @@ public: ShaderInput *add_input(const char *name, ShaderSocketType type, ShaderInput::DefaultValue value, int usage=ShaderInput::USE_ALL); ShaderOutput *add_output(const char *name, ShaderSocketType type); + ShaderInput *get_input(const char *name); + ShaderOutput *get_output(const char *name); + virtual ShaderNode *clone() const = 0; virtual void attributes(Shader *shader, AttributeRequestSet *attributes); virtual void compile(SVMCompiler& compiler) = 0;