diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2011-11-20 20:38:23 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2011-11-20 20:38:23 +0400 |
commit | 6673c76e78742c64ccd0afa7a9d1f598a8022878 (patch) | |
tree | 5304bf79c57391c4dcc561746e770e006ba45e18 /source/blender/nodes/composite | |
parent | bbf8315313a9e221ba398bbe06e342bd949c973b (diff) |
Muting node patch: second part. Also fix [#27636] Muting shading nodes is ignored
Now, compositing, shading and texture nodes have a consistent muting system, with default behaving as previous (for compo), and which can be optionaly customized by each node.
Shader nodes are also GLSL muted.
However, Cycles is currently unaware of muted nodes, will try to address this…
Diffstat (limited to 'source/blender/nodes/composite')
6 files changed, 34 insertions, 44 deletions
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 1a1d744fb1b..d6a1c50162b 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -228,7 +228,11 @@ bNodeTreeType ntreeType_Composite = { /* local_sync */ local_sync, /* local_merge */ local_merge, /* update */ update, - /* update_node */ update_node + /* update_node */ update_node, + /* validate_link */ NULL, + /* mutefunc */ node_compo_pass_on, + /* mutelinksfunc */ node_mute_get_links, + /* gpumutefunc */ NULL }; @@ -356,13 +360,8 @@ static void *exec_composite_node(void *nodeexec_v) node_get_stack(node, thd->stack, nsin, nsout); - if((node->flag & NODE_MUTED) && (!node_only_value(node))) { - /* viewers we execute, for feedback to user */ - if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) - node->typeinfo->execfunc(thd->rd, node, nsin, nsout); - else - node_compo_pass_on(node, nsin, nsout); - } + if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc) + node->typeinfo->mutefunc(thd->rd, 0, node, nodeexec->data, nsin, nsout); else if(node->typeinfo->execfunc) node->typeinfo->execfunc(thd->rd, node, nsin, nsout); else if (node->typeinfo->newexecfunc) diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index ddd55790436..99a36691b10 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -131,44 +131,29 @@ void compbuf_set_node(CompBuf *cbuf, bNode *node) } /* used for disabling node (similar code in node_draw.c for disable line and node_edit for untangling nodes) */ -void node_compo_pass_on(bNode *node, bNodeStack **nsin, bNodeStack **nsout) +void node_compo_pass_on(void *UNUSED(data), int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata), + struct bNodeStack **in, struct bNodeStack **out) { - CompBuf *valbuf= NULL, *colbuf= NULL, *vecbuf= NULL; - bNodeSocket *sock; - int a; - - /* connect the first value buffer in with first value out */ - /* connect the first RGBA buffer in with first RGBA out */ - - /* test the inputs */ - for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) { - if(nsin[a]->data) { - CompBuf *cbuf= nsin[a]->data; - if(cbuf->type==1 && valbuf==NULL) valbuf= cbuf; - if(cbuf->type==3 && vecbuf==NULL) vecbuf= cbuf; - if(cbuf->type==4 && colbuf==NULL) colbuf= cbuf; - } - } - - /* outputs */ - if(valbuf || colbuf || vecbuf) { - for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { - if(nsout[a]->hasoutput) { - if(sock->type==SOCK_FLOAT && valbuf) { - nsout[a]->data= pass_on_compbuf(valbuf); - valbuf= NULL; - } - if(sock->type==SOCK_VECTOR && vecbuf) { - nsout[a]->data= pass_on_compbuf(vecbuf); - vecbuf= NULL; - } - if(sock->type==SOCK_RGBA && colbuf) { - nsout[a]->data= pass_on_compbuf(colbuf); - colbuf= NULL; - } - } + ListBase links; + LinkInOutsMuteNode *lnk; + int i; + + if(node->typeinfo->mutelinksfunc == NULL) + return; + + /* Get default muting links (as bNodeStack pointers). */ + links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL); + + for(lnk = links.first; lnk; lnk = lnk->next) { + for(i = 0; i < lnk->num_outs; i++) { + if(((bNodeStack*)(lnk->in))->data) + (((bNodeStack*)(lnk->outs))+i)->data = pass_on_compbuf((CompBuf*)((bNodeStack*)(lnk->in))->data); } + /* If num_outs > 1, lnk->outs was an allocated table of pointers... */ + if(i > 1) + MEM_freeN(lnk->outs); } + BLI_freelistN(&links); } diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index 9cac4c477eb..bb606f4202e 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -124,7 +124,7 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf); void free_compbuf(CompBuf *cbuf); void print_compbuf(char *str, CompBuf *cbuf); void compbuf_set_node(struct CompBuf *cbuf, struct bNode *node); -void node_compo_pass_on(struct bNode *node, struct bNodeStack **nsin, struct bNodeStack **nsout); +void node_compo_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out); CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type); CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy); diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 828dd8fcfc7..a5f90d31643 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -105,6 +105,8 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype) node_type_socket_templates(&ntype, cmp_node_composite_in, NULL); node_type_size(&ntype, 80, 60, 200); node_type_exec(&ntype, node_composit_exec_composite); + /* Do not allow muting for this node. */ + node_type_mute(&ntype, NULL, NULL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index c801c34e8b5..bc8bc7c84d1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -159,6 +159,8 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype) node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_splitviewer); + /* Do not allow muting this node. */ + node_type_mute(&ntype, NULL, NULL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index 46051caced2..6a0c074cdb3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -141,6 +141,8 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype) node_type_init(&ntype, node_composit_init_viewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_viewer); + /* Do not allow muting this node. */ + node_type_mute(&ntype, NULL, NULL); nodeRegisterType(ttype, &ntype); } |