[Bf-blender-cvs] [46d3cb7] depsgraph_refactor: Ported the subgraph node builder function.

Lukas Tönne noreply at git.blender.org
Sat Apr 12 09:34:31 CEST 2014


Commit: 46d3cb7792fdbeefddf8ad5c64d5933475b36e1f
Author: Lukas Tönne
Date:   Sat Apr 12 09:23:19 2014 +0200
https://developer.blender.org/rB46d3cb7792fdbeefddf8ad5c64d5933475b36e1f

Ported the subgraph node builder function.

This is mostly a stub at this point, needs to be looked at.

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

M	source/blender/depsgraph/intern/depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 3537a6a..bb29b2b 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -52,6 +52,7 @@ struct World;
 struct Depsgraph;
 struct DepsNode;
 struct RootDepsNode;
+struct SubgraphDepsNode;
 struct IDDepsNode;
 struct TimeSourceDepsNode;
 struct ComponentDepsNode;
@@ -71,6 +72,7 @@ struct DepsgraphNodeBuilder {
 	
 	IDDepsNode *build_scene(Scene *scene);
 	SubgraphDepsNode *build_subgraph(Group *group);
+	void build_group(Group *group);
 	IDDepsNode *build_object(Scene *scene, Object *ob);
 	ComponentDepsNode *build_object_transform(Object *ob, IDDepsNode *ob_node);
 	void build_constraints(ComponentDepsNode *comp_node, eDepsNode_Type constraint_op_type);
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index e0d5717..fb6c70e 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -176,9 +176,43 @@ IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
 	return scene_node;
 }
 
+/* Build depsgraph for the given group
+ * This is usually used for building subgraphs for groups to use
+ */
+void DepsgraphNodeBuilder::build_group(Group *group)
+{
+	/* add group objects */
+	for (GroupObject *go = (GroupObject *)group->gobject.first; go; go = go->next) {
+		/*Object *ob = go->ob;*/
+		
+		/* Each "group object" is effectively a separate instance of the underlying
+		 * object data. When the group is evaluated, the transform results and/or 
+		 * some other attributes end up getting overridden by the group
+		 */
+	}
+}
+
 SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
 {
+	/* sanity checks */
+	if (!group)
+		return NULL;
+	
+	/* create new subgraph's data */
+	Depsgraph *subgraph = DEG_graph_new();
+	
+	DepsgraphNodeBuilder subgraph_builder(m_bmain, subgraph);
+	subgraph_builder.build_group(group);
+	
+	/* create a node for representing subgraph */
+	SubgraphDepsNode *subgraph_node = (SubgraphDepsNode *)m_graph->add_new_node(&group->id, "", DEPSNODE_TYPE_SUBGRAPH, group->id.name+2);
+	subgraph_node->graph = subgraph;
+	
+	/* make a copy of the data this node will need? */
+	// XXX: do we do this now, or later?
+	// TODO: need API function which queries graph's ID's hash, and duplicates those blocks thoroughly with all outside links removed...
 	
+	return subgraph_node;
 }
 
 IDDepsNode *DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
@@ -187,7 +221,7 @@ IDDepsNode *DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
 	IDDepsNode *ob_node = add_id_node(ob);
 	
 	/* standard components */
-	ComponentDepsNode *params_node = add_component_node(ob_node, DEPSNODE_TYPE_OP_PARAMETER);
+	/*ComponentDepsNode *params_node =*/ add_component_node(ob_node, DEPSNODE_TYPE_OP_PARAMETER);
 	ComponentDepsNode *trans_node = build_object_transform(ob, ob_node);
 	
 	/* AnimData */




More information about the Bf-blender-cvs mailing list