diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 631c4e76115..7f8a27bd947 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1983,6 +1983,33 @@ static void node_group_execute(bNodeStack *stack, void *data, bNode *gnode, bNod node->typeinfo->execfunc(data, node, nsin, nsout); } } + + /* free internal buffers */ + if (ntree->type==NTREE_COMPOSIT) { + bNodeSocket *sock; + bNodeStack *ns; + for (sock=ntree->outputs.first; sock; sock=sock->next) { + /* use the hasoutput flag to tag external sockets */ + if (sock->stack_type==SOCK_STACK_LOCAL) { + ns= get_socket_stack(stack, sock, in); + ns->hasoutput = 0; + } + } + /* now free all stacks that are not used from outside */ + for (node=ntree->nodes.first; node; node=node->next) { + for (sock=node->outputs.first; sock; sock=sock->next) { + if (sock->stack_type==SOCK_STACK_LOCAL ) { + ns= get_socket_stack(stack, sock, in); + if (ns->hasoutput!=0 && ns->data) { + free_compbuf(ns->data); + ns->data = NULL; + /* reset the flag */ + ns->hasoutput = 1; + } + } + } + } + } } static int set_stack_indexes_default(bNode *node, int index) |