Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-10-02 01:56:36 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-10-02 01:56:36 +0400
commit734b7b969db315f5ab548b5a8104fc35f29d0f51 (patch)
treeccabdd897dc422c7188df29c58a4d85cc7e413a6 /source/blender/blenkernel/intern/node.c
parent99ebe229f6c08aceaafbbad8fc1142422ee4c6f3 (diff)
Fix #23932: compositing nodes with viewer and split viewer node could
crash, with two threads writing to the same image.
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r--source/blender/blenkernel/intern/node.c80
1 files changed, 50 insertions, 30 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 135ddbab2b7..ad3491b5dba 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1690,6 +1690,50 @@ static int node_recurs_check(bNode *node, bNode ***nsort, int level)
return 0xFFF;
}
+
+static void ntreeSetOutput(bNodeTree *ntree)
+{
+ bNode *node;
+
+ printf("\n");
+
+ /* 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) {
+ /* same type, exception for viewer */
+ if(tnode->type==node->type ||
+ (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) &&
+ ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))) {
+ if(tnode->flag & NODE_DO_OUTPUT) {
+ output++;
+ if(output>1)
+ tnode->flag &= ~NODE_DO_OUTPUT;
+ }
+ }
+ }
+ }
+ if(output==0)
+ node->flag |= NODE_DO_OUTPUT;
+
+ if(node->flag & NODE_DO_OUTPUT)
+ printf("do output %s\n", node->name);
+ }
+ }
+
+ /* here we could recursively set which nodes have to be done,
+ might be different for editor or for "real" use... */
+}
+
void ntreeSolveOrder(bNodeTree *ntree)
{
bNode *node, **nodesort, **nsort;
@@ -1738,38 +1782,11 @@ void ntreeSolveOrder(bNodeTree *ntree)
}
MEM_freeN(nodesort);
-
- /* 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(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;
- }
- }
-
- /* here we could recursively set which nodes have to be done,
- might be different for editor or for "real" use... */
+
+ ntreeSetOutput(ntree);
}
+
/* Should be callback! */
/* Do not call execs here */
void NodeTagChanged(bNodeTree *ntree, bNode *node)
@@ -2466,6 +2483,9 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
/* fixed seed, for example noise texture */
BLI_srandom(rd->cfra);
+ /* ensures only a single output node is enabled */
+ ntreeSetOutput(ntree);
+
/* sets need_exec tags in nodes */
curnode = totnode= setExecutableNodes(ntree, &thdata);