[Bf-blender-cvs] [2103e21] master: Fix T47870: Missing viewport update when material output is inside of the group

Sergey Sharybin noreply at git.blender.org
Wed Mar 23 15:42:26 CET 2016


Commit: 2103e2112cca3e3385ac057bbe8976925eadd6d4
Author: Sergey Sharybin
Date:   Wed Mar 23 15:41:36 2016 +0100
Branches: master
https://developer.blender.org/rB2103e2112cca3e3385ac057bbe8976925eadd6d4

Fix T47870: Missing viewport update when material output is inside of the group

===================================================================

M	source/blender/editors/space_node/node_relationships.c

===================================================================

diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index d230ebf..6a09605 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -93,12 +93,60 @@ static bool ntree_check_nodes_connected(bNodeTree *ntree, bNode *from, bNode *to
 	return ntree_check_nodes_connected_dfs(ntree, from, to);
 }
 
+static bool node_group_has_output_dfs(bNode *node)
+{
+	if (node->flag & NODE_TEST) {
+		return false;
+	}
+	node->flag |= NODE_TEST;
+	bNodeTree *ntree = (bNodeTree *)node->id;
+	for (bNode *current_node = ntree->nodes.first;
+	     current_node != NULL;
+	     current_node = current_node->next)
+	{
+		if (current_node->type == NODE_GROUP) {
+			if (node_group_has_output_dfs(current_node)) {
+				return true;
+			}
+		}
+		if (current_node->flag & NODE_DO_OUTPUT &&
+		    current_node->type != NODE_GROUP_OUTPUT)
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+static bool node_group_has_output(bNode *node)
+{
+	BLI_assert(node->type == NODE_GROUP);
+	bNodeTree *ntree = (bNodeTree *)node->id;
+	if (ntree == NULL) {
+		return false;
+	}
+	ntreeNodeFlagSet(ntree, NODE_TEST, false);
+	return node_group_has_output_dfs(node);
+}
+
 bool node_connected_to_output(bNodeTree *ntree, bNode *node)
 {
 	for (bNode *current_node = ntree->nodes.first;
 	     current_node != NULL;
 	     current_node = current_node->next)
 	{
+		/* Special case for group nodes -- if modified node connected to a group
+		 * with active output inside we consider refresh is needed.
+		 *
+		 * We could make check more grained here by taking which socket the node
+		 * is connected to and so eventually.
+		 */
+		if (current_node->type == NODE_GROUP &&
+		    ntree_check_nodes_connected(ntree, node, current_node) &&
+		    node_group_has_output(current_node))
+		{
+			return true;
+		}
 		if (current_node->flag & NODE_DO_OUTPUT) {
 			if (ntree_check_nodes_connected(ntree, node, current_node)) {
 				return true;




More information about the Bf-blender-cvs mailing list