Cycles: Add utility functions to get a ShaderInput / ShaderOutput by name.
This commit is contained in:
parent
c2c11debe5
commit
38bbc920a6
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user