Cleanup: Use topology cache of group output node
Using a cache greatly simplifies access to the output node. I touched on the most common and understandable cases for me. The texture nodes were touched because it looked pretty generic. Differential Revision: https://developer.blender.org/D16699
This commit is contained in:
@@ -84,24 +84,24 @@ static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
||||
*/
|
||||
static void group_copy_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
int a;
|
||||
const bNodeTree &ngroup = *reinterpret_cast<bNodeTree *>(gnode->id);
|
||||
|
||||
for (node = static_cast<bNode *>(ngroup->nodes.first); node; node = node->next) {
|
||||
if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
|
||||
for (sock = static_cast<bNodeSocket *>(node->inputs.first), a = 0; sock;
|
||||
sock = sock->next, a++) {
|
||||
if (out[a]) { /* shouldn't need to check this T36694. */
|
||||
ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
copy_stack(out[a], ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
break; /* only one active output node */
|
||||
ngroup.ensure_topology_cache();
|
||||
const bNode *group_output_node = ngroup.group_output_node();
|
||||
if (!group_output_node) {
|
||||
return;
|
||||
}
|
||||
|
||||
int a;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &group_output_node->inputs, a) {
|
||||
if (!out[a]) {
|
||||
/* shouldn't need to check this T36694. */
|
||||
continue;
|
||||
}
|
||||
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
copy_stack(out[a], ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user