Generalized node groups for Cycles.

This allows group nodes inside other group nodes in cycles and makes the
code more generic for all possible cases, like direct group
input-to-output links and unused group sockets.

Previous code tried to connect external nodes and internal group sockets
by following links until a "real" node input/output. This quickly
becomes complicated in corner cases as described above and can lead to
unexpected behavior when the group socket is of a different type than
the internal/external sockets, but that conversion is skipped.

The new code uses the concept of "proxy nodes" similar to what the new
compositor does. Each group socket is replaced with a proxy node with a
single input and output, to which other nodes in the same tree and
internal nodes can link to. After all groups have been expanded in the
graph, these proxy nodes are removed again, adding converter nodes if
necessary.
This commit is contained in:
Lukas Toenne
2011-12-18 15:34:06 +00:00
parent b49463c439
commit 5f6bd44c82
6 changed files with 200 additions and 104 deletions

View File

@@ -869,6 +869,26 @@ void ConvertNode::compile(OSLCompiler& compiler)
assert(0);
}
/* Proxy */
ProxyNode::ProxyNode(ShaderSocketType from_, ShaderSocketType to_)
: ShaderNode("proxy")
{
from = from_;
to = to_;
add_input("Input", from);
add_output("Output", to);
}
void ProxyNode::compile(SVMCompiler& compiler)
{
}
void ProxyNode::compile(OSLCompiler& compiler)
{
}
/* BSDF Closure */
BsdfNode::BsdfNode()