diff options
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 45 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 16 |
2 files changed, 43 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 663a2d8844c..f52a538cc00 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1705,21 +1705,22 @@ static void ntreeSetOutput(bNodeTree *ntree) { bNode *node; - if(ntree->type==NTREE_COMPOSIT) { - - /* find the active outputs, might become tree type dependant handler */ - for(node= ntree->nodes.first; node; node= node->next) { - if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) { - bNode *tnode; - int output= 0; - - /* we need a check for which output node should be tagged like this, below an exception */ - if(node->type==CMP_NODE_OUTPUT_FILE) - continue; - - /* there is more types having output class, each one is checked */ - for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) { - if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) { + /* find the active outputs, might become tree type dependant handler */ + for(node= ntree->nodes.first; node; node= node->next) { + if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) { + bNode *tnode; + int output= 0; + + /* we need a check for which output node should be tagged like this, below an exception */ + if(node->type==CMP_NODE_OUTPUT_FILE) + continue; + + /* there is more types having output class, each one is checked */ + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) { + if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) { + + if(ntree->type==NTREE_COMPOSIT) { + /* same type, exception for viewer */ if(tnode->type==node->type || (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && @@ -1731,10 +1732,20 @@ static void ntreeSetOutput(bNodeTree *ntree) } } } + else { + /* same type */ + if(tnode->type==node->type) { + if(tnode->flag & NODE_DO_OUTPUT) { + output++; + if(output>1) + tnode->flag &= ~NODE_DO_OUTPUT; + } + } + } } - if(output==0) - node->flag |= NODE_DO_OUTPUT; } + if(output==0) + node->flag |= NODE_DO_OUTPUT; } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 2a93eff9e9e..892f4b2b3aa 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -433,11 +433,25 @@ void node_set_active(SpaceNode *snode, bNode *node) nodeSetActive(snode->edittree, node); if(node->type!=NODE_GROUP) { + int was_output= (node->flag & NODE_DO_OUTPUT); + /* tree specific activate calls */ if(snode->treetype==NTREE_SHADER) { /* when we select a material, active texture is cleared, for buttons */ if(node->id && GS(node->id->name)==ID_MA) nodeClearActiveID(snode->edittree, ID_TE); + + if(node->type==SH_NODE_OUTPUT) { + bNode *tnode; + + for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + if( tnode->type==SH_NODE_OUTPUT) + tnode->flag &= ~NODE_DO_OUTPUT; + + node->flag |= NODE_DO_OUTPUT; + if(was_output==0) + ED_node_changed_update(snode->id, node); + } // XXX #if 0 @@ -454,7 +468,7 @@ void node_set_active(SpaceNode *snode, bNode *node) /* make active viewer, currently only 1 supported... */ if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { bNode *tnode; - int was_output= (node->flag & NODE_DO_OUTPUT); + for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) |