[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49175] trunk/blender/source/blender: fix/ workaround for glitch with node editing active texture bug - where a node texture in a group could get `stuck` and the buttons UI wouldnt update to other active nodes .

Campbell Barton ideasman42 at gmail.com
Tue Jul 24 14:35:42 CEST 2012


Revision: 49175
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49175
Author:   campbellbarton
Date:     2012-07-24 12:35:41 +0000 (Tue, 24 Jul 2012)
Log Message:
-----------
fix/workaround for glitch with node editing active texture bug - where a node texture in a group could get `stuck` and the buttons UI wouldnt update to other active nodes.

Files saved with this error will still give problems, toggling group edit will fix.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/node_edit.c
    trunk/blender/source/blender/makesdna/DNA_node_types.h

Modified: trunk/blender/source/blender/editors/space_node/node_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_edit.c	2012-07-24 12:18:40 UTC (rev 49174)
+++ trunk/blender/source/blender/editors/space_node/node_edit.c	2012-07-24 12:35:41 UTC (rev 49175)
@@ -796,8 +796,15 @@
 	bNode *node;
 	
 	/* make sure nothing has group editing on */
-	for (node = snode->nodetree->nodes.first; node; node = node->next)
+	for (node = snode->nodetree->nodes.first; node; node = node->next) {
 		nodeGroupEditClear(node);
+
+		/* while we're here, clear texture active */
+		if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
+			/* this is not 100% sure to be reliable, see comment on the flag */
+			node->flag &= ~NODE_ACTIVE_TEXTURE;
+		}
+	}
 	
 	if (gnode == NULL) {
 		/* with NULL argument we do a toggle */
@@ -809,8 +816,14 @@
 		snode->edittree = nodeGroupEditSet(gnode, 1);
 		
 		/* deselect all other nodes, so we can also do grabbing of entire subtree */
-		for (node = snode->nodetree->nodes.first; node; node = node->next)
+		for (node = snode->nodetree->nodes.first; node; node = node->next) {
 			node_deselect(node);
+
+			if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
+				/* this is not 100% sure to be reliable, see comment on the flag */
+				node->flag &= ~NODE_ACTIVE_TEXTURE;
+			}
+		}
 		node_select(gnode);
 	}
 	else 

Modified: trunk/blender/source/blender/makesdna/DNA_node_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_node_types.h	2012-07-24 12:18:40 UTC (rev 49174)
+++ trunk/blender/source/blender/makesdna/DNA_node_types.h	2012-07-24 12:35:41 UTC (rev 49175)
@@ -211,6 +211,11 @@
 	/* automatic flag for nodes included in transforms */
 #define NODE_TRANSFORM		(1<<13)
 	/* node is active texture */
+
+	/* note: take care with this flag since its possible it gets
+	 * `stuck` inside/outside the active group - which makes buttons
+	 * window texture not update, we try to avoid it by clearing the
+	 * flag when toggling group editing - Campbell */
 #define NODE_ACTIVE_TEXTURE	(1<<14)
 	/* use a custom color for the node */
 #define NODE_CUSTOM_COLOR	(1<<15)




More information about the Bf-blender-cvs mailing list