[Bf-blender-cvs] [b26b846] depsgraph_refactor: Simplified operation building: Use ID pointers and component identifiers directly instead of passing around nodes.

Lukas Tönne noreply at git.blender.org
Thu Jun 19 09:11:32 CEST 2014


Commit: b26b846c2b23f49fb9b7000ee5983051a7d14365
Author: Lukas Tönne
Date:   Thu Jun 19 08:57:22 2014 +0200
https://developer.blender.org/rBb26b846c2b23f49fb9b7000ee5983051a7d14365

Simplified operation building: Use ID pointers and component identifiers
directly instead of passing around nodes.

This is to some degree a revert of previous changes to add such nodes
explicitly. However, it only applies to ID and component nodes, which
are really nothing more than categories (sorting operations by ID and
components).

The only exception now are the node tree build functions, which still
take a "owner_node" and need to be looked at.

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

M	source/blender/depsgraph/intern/depsgraph_build.cpp
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.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 886027f..ef17195 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -209,8 +209,9 @@ TimeSourceDepsNode *DepsgraphNodeBuilder::add_time_source(IDPtr id)
 	return NULL;
 }
 
-ComponentDepsNode *DepsgraphNodeBuilder::add_component_node(IDDepsNode *id_node, eDepsNode_Type comp_type, const string &comp_name)
+ComponentDepsNode *DepsgraphNodeBuilder::add_component_node(IDPtr id, eDepsNode_Type comp_type, const string &comp_name)
 {
+	IDDepsNode *id_node = add_id_node(id);
 	ComponentDepsNode *comp_node = id_node->add_component(comp_type, comp_name);
 	comp_node->owner = id_node;
 	return comp_node;
@@ -224,12 +225,12 @@ OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(ComponentDepsNode *c
 	return op_node;
 }
 
-OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(IDDepsNode *id_node, eDepsNode_Type comp_type,
+OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(IDPtr id, eDepsNode_Type comp_type, const string &comp_name,
                                                             eDepsOperation_Type optype, DepsEvalOperationCb op, const string &description)
 {
-	ComponentDepsNode *comp_node = id_node->add_component(comp_type);
-	OperationDepsNode *op_node = comp_node->add_operation(optype, op, description);
+	ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name);
 	
+	OperationDepsNode *op_node = comp_node->add_operation(optype, op, description);
 	m_graph->operations.push_back(op_node);
 	
 	return op_node;
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 4b875ed..62d909f 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -109,38 +109,45 @@ struct DepsgraphNodeBuilder {
 	RootDepsNode *add_root_node();
 	IDDepsNode *add_id_node(IDPtr id);
 	TimeSourceDepsNode *add_time_source(IDPtr id);
-	ComponentDepsNode *add_component_node(IDDepsNode *id_node, eDepsNode_Type comp_type, const string &comp_name = "");
+	
+	ComponentDepsNode *add_component_node(IDPtr id, eDepsNode_Type comp_type, const string &comp_name = "");
+	
 	OperationDepsNode *add_operation_node(ComponentDepsNode *comp_node,
 	                                      eDepsOperation_Type optype, DepsEvalOperationCb op, const string &description);
-	OperationDepsNode *add_operation_node(IDDepsNode *id_node, eDepsNode_Type comp_type,
+	OperationDepsNode *add_operation_node(IDPtr id, eDepsNode_Type comp_type, const string &comp_name,
 	                                      eDepsOperation_Type optype, DepsEvalOperationCb op, const string &description);
+	OperationDepsNode *add_operation_node(IDPtr id, eDepsNode_Type comp_type,
+	                                      eDepsOperation_Type optype, DepsEvalOperationCb op, const string &description)
+	{
+		return add_operation_node(id, comp_type, "", optype, op, description);
+	}
 	
 	void verify_entry_exit_operations();
 	
-	IDDepsNode *build_scene(Scene *scene);
+	void 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_object_constraints(Object *ob, IDDepsNode *ob_node);
-	void build_pose_constraints(Object *ob, bPoseChannel *pchan, BoneComponentDepsNode *bone_node);
-	void build_rigidbody(IDDepsNode *scene_node, Scene *scene);
-	void build_particles(IDDepsNode *ob_node, Object *ob);
-	void build_animdata(IDDepsNode *id_node);
-	OperationDepsNode *build_driver(IDDepsNode *id_node, FCurve *fcurve);
-	void build_ik_pose(ComponentDepsNode *bone_node, Object *ob, bPoseChannel *pchan, bConstraint *con);
-	void build_splineik_pose(ComponentDepsNode *bone_node, Object *ob, bPoseChannel *pchan, bConstraint *con);
-	void build_rig(IDDepsNode *ob_node, Object *ob);
+	void build_object(Scene *scene, Object *ob);
+	void build_object_transform(Object *ob);
+	void build_object_constraints(Object *ob);
+	void build_pose_constraints(Object *ob, bPoseChannel *pchan);
+	void build_rigidbody(Scene *scene);
+	void build_particles(Object *ob);
+	void build_animdata(IDPtr id);
+	OperationDepsNode *build_driver(IDPtr id, FCurve *fcurve);
+	void build_ik_pose(Object *ob, bPoseChannel *pchan, bConstraint *con);
+	void build_splineik_pose(Object *ob, bPoseChannel *pchan, bConstraint *con);
+	void build_rig(Object *ob);
 	void build_shapekeys(Key *key);
-	void build_obdata_geom(IDDepsNode *ob_node, IDDepsNode *obdata_node, Scene *scene, Object *ob);
-	void build_camera(IDDepsNode *ob_node, IDDepsNode *obdata_node, Object *ob);
-	void build_lamp(IDDepsNode *ob_node, IDDepsNode *obdata_node, Object *ob);
+	void build_obdata_geom(Scene *scene, Object *ob);
+	void build_camera(Object *ob);
+	void build_lamp(Object *ob);
 	void build_nodetree(DepsNode *owner_node, bNodeTree *ntree);
 	void build_material(DepsNode *owner_node, Material *ma);
 	void build_texture(DepsNode *owner_node, Tex *tex);
 	void build_texture_stack(DepsNode *owner_node, MTex **texture_stack);
 	void build_world(World *world);
-	void build_compositor(IDDepsNode *scene_node, Scene *scene);
+	void build_compositor(Scene *scene);
 	
 protected:
 	void verify_entry_exit_operations(ComponentDepsNode *node);
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 1a2fbc2..df996d9 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -104,9 +104,8 @@ extern "C" {
 /* ************************************************* */
 /* Node Builder */
 
-IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
+void DepsgraphNodeBuilder::build_scene(Scene *scene)
 {
-	IDDepsNode *scene_node = add_id_node(scene);
 	/* timesource */
 	add_time_source(scene);
 	
@@ -152,12 +151,12 @@ IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
 	
 	/* rigidbody */
 	if (scene->rigidbody_world) {
-		build_rigidbody(scene_node, scene);
+		build_rigidbody(scene);
 	}
 	
 	/* scene's animation and drivers */
 	if (scene->adt) {
-		build_animdata(scene_node);
+		build_animdata(scene);
 	}
 	
 	/* world */
@@ -167,13 +166,11 @@ IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
 	
 	/* compo nodes */
 	if (scene->nodetree) {
-		build_compositor(scene_node, scene);
+		build_compositor(scene);
 	}
 	
 	/* sequencer */
 	// XXX...
-	
-	return scene_node;
 }
 
 /* Build depsgraph for the given group
@@ -215,36 +212,31 @@ SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
 	return subgraph_node;
 }
 
-IDDepsNode *DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
+void DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
 {
-	/* create node for object itself */
-	IDDepsNode *ob_node = add_id_node(ob);
-	
 	/* standard components */
-	/*ComponentDepsNode *params_node =*/ add_component_node(ob_node, DEPSNODE_TYPE_PARAMETERS);
-	ComponentDepsNode *trans_node = build_object_transform(ob, ob_node);
+	build_object_transform(ob);
 	
 	/* AnimData */
-	build_animdata(ob_node);
+	build_animdata(ob);
 	
 	/* object parent */
 	if (ob->parent) {
-		add_operation_node(trans_node,
+		add_operation_node(ob, DEPSNODE_TYPE_TRANSFORM,
 		                   DEPSOP_TYPE_EXEC, bind(BKE_object_eval_parent, ob),
 		                   deg_op_name_object_parent);
 	}
 	
 	/* object constraints */
 	if (ob->constraints.first) {
-		build_object_constraints(ob, ob_node);
+		build_object_constraints(ob);
 	}
 	
 	/* object data */
 	if (ob->data) {
-		ID *obdata_id = (ID *)ob->data;
-		IDDepsNode *obdata_node = add_id_node(obdata_id);
+		ID *obdata = (ID *)ob->data;
 		/* ob data animation */
-		build_animdata(obdata_node);
+		build_animdata(obdata);
 		
 		/* type-specific data... */
 		switch (ob->type) {
@@ -255,45 +247,36 @@ IDDepsNode *DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
 			case OB_MBALL:
 			case OB_LATTICE:
 			{
-				build_obdata_geom(ob_node, obdata_node, scene, ob);
+				build_obdata_geom(scene, ob);
 			}
 			break;
 			
 			case OB_ARMATURE: /* Pose */
-				build_rig(ob_node, ob);
+				build_rig(ob);
 				break;
 			
 			case OB_LAMP:   /* Lamp */
-				build_lamp(ob_node, obdata_node, ob);
+				build_lamp(ob);
 				break;
 				
 			case OB_CAMERA: /* Camera */
-				build_camera(ob_node, obdata_node, ob);
+				build_camera(ob);
 				break;
 		}
 	}
 	
 	/* particle systems */
 	if (ob->particlesystem.first) {
-		build_particles(ob_node, ob);
+		build_particles(ob);
 	}
-	
-	/* return object node... */
-	return ob_node;
 }
 
-ComponentDepsNode *DepsgraphNodeBuilder::build_object_transform(Object *ob, IDDepsNode *ob_node)
+void DepsgraphNodeBuilder::build_object_transform(Object *ob)
 {
-	/* component to hold all transform operations */
-	ComponentDepsNode *trans_node = add_component_node(ob_node, DEPSNODE_TYPE_TRANSFORM);
-	
 	/* init operation */
-	add_operation_node(trans_node,
+	add_operation_node(ob, DEPSNODE_TYPE_TRANSFORM,
 	                   DEPSOP_TYPE_INIT, bind_operation(BKE_object_eval_local_transform, ob, 3, 6, 12),
 	                   deg_op_name_object_local_transform);
-	
-	/* return component created */
-	return trans_node;
 }
 
 /* == Constraints Graph Notes ==
@@ -311,21 +294,18 @@ ComponentDepsNode *DepsgraphNodeBuilder::build_object_transform(Object *ob, IDDe
  *
  * -- Aligorith, August 2013 
  */
-void DepsgraphNodeBuilder::build_object_constraints(Object *ob, IDDepsNode *ob_node)
+void DepsgraphNodeBuilder::build_object_constraints(Object *ob)
 {
-	/* component to hold all transform operations */
-	ComponentDepsNode *trans_node = add_component_node(ob_node, DEPSNODE_TYPE_TRANSFORM);
-	
 	/* create node for constraint stack */
-	add_operation_node(trans_node,
+	add_operation_node(ob, DEPSNODE_TYPE_TRANSFORM,
 	                   DEPSOP_TYPE_EXEC, bind(BKE_object_constraints_evaluate, ob),
 	                   deg_op_name_

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list