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:
@@ -43,19 +43,20 @@ static void group_gpu_copy_inputs(bNode *gnode, GPUNodeStack *in, bNodeStack *gs
|
||||
*/
|
||||
static void group_gpu_move_outputs(bNode *gnode, GPUNodeStack *out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
const bNodeTree &ngroup = *reinterpret_cast<bNodeTree *>(gnode->id);
|
||||
|
||||
for (bNode *node : ngroup->all_nodes()) {
|
||||
if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
|
||||
int a;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, a) {
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
/* convert the node stack data result back to gpu stack */
|
||||
node_gpu_stack_from_data(&out[a], sock->type, 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) {
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
/* convert the node stack data result back to gpu stack */
|
||||
node_gpu_stack_from_data(&out[a], sock->type, ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user