[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33808] trunk/blender/source/blender: Bugfix #25309

Ton Roosendaal ton at blender.org
Mon Dec 20 12:08:29 CET 2010


Revision: 33808
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33808
Author:   ton
Date:     2010-12-20 12:08:29 +0100 (Mon, 20 Dec 2010)

Log Message:
-----------
Bugfix #25309

Code cleanup to allow switching active output nodes in Compositor
made shader nodes output not set correctly.

Now you can have multiple output nodes in shaders too, and switch
on click-activate.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/node.c
    trunk/blender/source/blender/editors/space_node/node_edit.c

Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c	2010-12-20 10:51:39 UTC (rev 33807)
+++ trunk/blender/source/blender/blenkernel/intern/node.c	2010-12-20 11:08:29 UTC (rev 33808)
@@ -1705,21 +1705,22 @@
 {
 	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 @@
 							}
 						}
 					}
+					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;
 		}
 	}
 	

Modified: trunk/blender/source/blender/editors/space_node/node_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_edit.c	2010-12-20 10:51:39 UTC (rev 33807)
+++ trunk/blender/source/blender/editors/space_node/node_edit.c	2010-12-20 11:08:29 UTC (rev 33808)
@@ -433,11 +433,25 @@
 	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 @@
 			/* 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))





More information about the Bf-blender-cvs mailing list