[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33139] branches/particles-2010/source/ blender/nodes/intern/SIM_nodetree.c: Fix for group node stack creation.

Lukas Toenne lukas.toenne at googlemail.com
Wed Nov 17 17:33:56 CET 2010


Revision: 33139
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33139
Author:   lukastoenne
Date:     2010-11-17 17:33:56 +0100 (Wed, 17 Nov 2010)

Log Message:
-----------
Fix for group node stack creation. Group nodes were not setting a valid stack index for their sockets, which is needed when these are accessed by other nodes. The group node socket indices are now set to the internal socket indices (after those have been calculated!).

Modified Paths:
--------------
    branches/particles-2010/source/blender/nodes/intern/SIM_nodetree.c

Modified: branches/particles-2010/source/blender/nodes/intern/SIM_nodetree.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodetree.c	2010-11-17 16:25:30 UTC (rev 33138)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodetree.c	2010-11-17 16:33:56 UTC (rev 33139)
@@ -565,40 +565,74 @@
 	
 	for(node= ntree->nodes.first; node; node= node->next) {
 //		node->stack_index = (*totout);	/* unused */
-		if (node->type != NODE_GROUP)
+		if (node->type != NODE_GROUP) {
 			++(*totnode);
-		
-		for (sock=node->outputs.first; sock; sock = sock->next) {
-			/* group nodes use their internal nodes sockets */
-			if (node->type != NODE_GROUP)
+			
+			for (sock=node->outputs.first; sock; sock = sock->next) {
 				sock->stack_index = (*totout)++;
-			else
-				sock->stack_index = -1;
-			if (sock->intern)
-				sock->stack_index_ext = -1;
-			else
-				sock->stack_index_ext = ext_out++;
-		}
-		/* defaulted input sockets also have a stack entry */
-		for (sock=node->inputs.first; sock; sock = sock->next) {
-			if (node->type != NODE_GROUP)
+				if (sock->intern)
+					sock->stack_index_ext = -1;
+				else
+					sock->stack_index_ext = ext_out++;
+			}
+			for (sock=node->inputs.first; sock; sock = sock->next) {
 				(*totin)++;
-			
-			if (sock->intern) {
-				if (sock->link && sock->link->fromnode)
+				
+				if (sock->intern) {
+					if (sock->link && sock->link->fromnode)
+						sock->stack_index = -1;
+					else
+						/* defaulted input sockets also have a stack entry */
+						sock->stack_index = (*totout)++;
+					sock->stack_index_ext = -1;
+				}
+				else {
 					sock->stack_index = -1;
+					sock->stack_index_ext = ext_in++;
+				}
+			}
+		}
+		else {
+			for (sock=node->outputs.first; sock; sock = sock->next) {
+				/* sock->stack_index is set after the internal sockets are prepared */
+				if (sock->intern)
+					sock->stack_index_ext = -1;
 				else
-					sock->stack_index = (*totout)++;
-				sock->stack_index_ext = -1;
+					sock->stack_index_ext = ext_out++;
 			}
-			else {
-				sock->stack_index = -1;
-				sock->stack_index_ext = ext_in++;
+			/* defaulted input sockets also have a stack entry */
+			for (sock=node->inputs.first; sock; sock = sock->next) {
+				if (sock->intern) {
+					if (sock->link && sock->link->fromnode) {
+						/* sock->stack_index is set after the internal sockets are prepared */
+					}
+					else
+						sock->stack_index = (*totout)++;
+					sock->stack_index_ext = -1;
+				}
+				else {
+					/* sock->stack_index is set after the internal sockets are prepared */
+					sock->stack_index_ext = ext_in++;
+				}
 			}
+		
+			if (node->id)
+				calc_stack_indexes_recursive((bNodeTree *)node->id, totnode, totin, totout);
+			
+			/* group nodes use their internal nodes sockets */
+			for (sock=node->outputs.first; sock; sock = sock->next) {
+				sock->stack_index = sock->tosock->stack_index;
+			}
+			for (sock=node->inputs.first; sock; sock = sock->next) {
+				if (sock->intern) {
+					if (sock->link && sock->link->fromnode)
+						sock->stack_index = sock->tosock->stack_index;
+				}
+				else {
+					sock->stack_index = sock->tosock->stack_index;
+				}
+			}
 		}
-		
-		if (node->type == NODE_GROUP &&node->id)
-			calc_stack_indexes_recursive((bNodeTree *)node->id, totnode, totin, totout);
 	}
 }
 





More information about the Bf-blender-cvs mailing list