[Bf-blender-cvs] [b1c8112] object_nodes: Horrible fix for depsgraph/notifier updates through property changes in geometry nodes.

Lukas Tönne noreply at git.blender.org
Tue Nov 24 09:44:57 CET 2015


Commit: b1c811298046f53430f150f270e5541a5bf78ff7
Author: Lukas Tönne
Date:   Mon Nov 23 10:14:53 2015 +0100
Branches: object_nodes
https://developer.blender.org/rBb1c811298046f53430f150f270e5541a5bf78ff7

Horrible fix for depsgraph/notifier updates through property changes in geometry nodes.

This is really awful, but we don't have a good generic way of defining node tree relations
in the dependency graph yet. More importantly, the notifier system is not up to the task -
putting the responsibility for notifying into operators requires anticipating their effects,
which is not good at all for node operators which affect geometry through complex processing.
The depsgraph really should be handling this.

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

M	source/blender/depsgraph/intern/depsgraph_build_nodes.cc
M	source/blender/depsgraph/intern/depsgraph_build_relations.cc
M	source/blender/editors/space_node/node_draw.c

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cc b/source/blender/depsgraph/intern/depsgraph_build_nodes.cc
index 4c912f1..c33a762 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cc
@@ -1122,6 +1122,13 @@ void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree
 					build_nodetree(owner_node, group_ntree);
 				}
 			}
+			/* XXX this is weak */
+			else if (GS(bnode->id->name) == ID_NT) {
+				bNodeTree *group_ntree = (bNodeTree *)bnode->id;
+				if ((group_ntree->id.flag & LIB_DOIT) == 0) {
+					build_nodetree(owner_node, group_ntree);
+				}
+			}
 		}
 	}
 
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cc b/source/blender/depsgraph/intern/depsgraph_build_relations.cc
index 46b1a54..286e1c9 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cc
@@ -1810,6 +1810,20 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree)
 				add_relation(group_parameters_key, parameters_key,
 				             DEPSREL_TYPE_COMPONENT_ORDER, "Group Node");
 			}
+			/* XXX this is weak */
+			else if (GS(bnode->id->name) == ID_NT) {
+				bNodeTree *group_ntree = (bNodeTree *)bnode->id;
+				if ((group_ntree->id.flag & LIB_DOIT) == 0) {
+					build_nodetree(owner, group_ntree);
+					group_ntree->flag |= LIB_DOIT;
+				}
+				OperationKey group_parameters_key(&group_ntree->id,
+				                                  DEPSNODE_TYPE_PARAMETERS,
+				                                  DEG_OPCODE_PLACEHOLDER,
+				                                  "Parameters Eval");
+				add_relation(group_parameters_key, parameters_key,
+				             DEPSREL_TYPE_COMPONENT_ORDER, "Group Node");
+			}
 		}
 	}
 
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index e1eeda4..29a5abe 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -150,6 +150,18 @@ void ED_node_tag_update_id(ID *id)
 		DAG_id_tag_update(id, 0);
 		WM_main_add_notifier(NC_TEXTURE | ND_NODES, id);
 	}
+	/* XXX idname check below is a hack, the nodes are primarily
+	 * defined in python, but notifiers are not accessible there.
+	 * This should ideally happen through the depsgraph too,
+	 * but for now this is the only real option.
+	 */
+	else if (STREQ(ntree->idname, "GeometryNodeTree")) {
+		DAG_id_tag_update(id, 0);
+		/* XXX BS notifier, the system is too limited
+		 * to support nested node dependencies properly
+		 */
+		WM_main_add_notifier(NC_MATERIAL | ND_NODES, NULL);
+	}
 	else if (id == &ntree->id) {
 		/* node groups */
 		DAG_id_tag_update(id, 0);




More information about the Bf-blender-cvs mailing list