[Bf-blender-cvs] [97fa7974daa] master: Cleanup: Shuffle arguments in most used order

Sergey Sharybin noreply at git.blender.org
Fri Feb 1 15:40:45 CET 2019


Commit: 97fa7974daad5334508fffc825484e1942068d16
Author: Sergey Sharybin
Date:   Fri Feb 1 13:43:14 2019 +0100
Branches: master
https://developer.blender.org/rB97fa7974daad5334508fffc825484e1942068d16

Cleanup: Shuffle arguments in most used order

Quite often we need to create nodes which defines various
evaluation stages.

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

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M	source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index b0d06a30924..25174c996fe 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -210,14 +210,12 @@ ComponentNode *DepsgraphNodeBuilder::add_component_node(
 
 OperationNode *DepsgraphNodeBuilder::add_operation_node(
         ComponentNode *comp_node,
-        const DepsEvalOperationCb& op,
         OperationCode opcode,
+        const DepsEvalOperationCb& op,
         const char *name,
         int name_tag)
 {
-	OperationNode *op_node = comp_node->find_operation(opcode,
-	                                                       name,
-	                                                       name_tag);
+	OperationNode *op_node = comp_node->find_operation(opcode, name, name_tag);
 	if (op_node == NULL) {
 		op_node = comp_node->add_operation(op, opcode, name, name_tag);
 		graph_->operations.push_back(op_node);
@@ -237,37 +235,32 @@ OperationNode *DepsgraphNodeBuilder::add_operation_node(
         ID *id,
         NodeType comp_type,
         const char *comp_name,
-        const DepsEvalOperationCb& op,
         OperationCode opcode,
+        const DepsEvalOperationCb& op,
         const char *name,
         int name_tag)
 {
 	ComponentNode *comp_node = add_component_node(id, comp_type, comp_name);
-	return add_operation_node(comp_node, op, opcode, name, name_tag);
+	return add_operation_node(comp_node, opcode, op, name, name_tag);
 }
 
 OperationNode *DepsgraphNodeBuilder::add_operation_node(
         ID *id,
         NodeType comp_type,
-        const DepsEvalOperationCb& op,
         OperationCode opcode,
+        const DepsEvalOperationCb& op,
         const char *name,
         int name_tag)
 {
-	return add_operation_node(id,
-	                          comp_type,
-	                          "",
-	                          op,
-	                          opcode,
-	                          name,
-	                          name_tag);
+	return add_operation_node(
+	        id, comp_type, "", opcode, op, name, name_tag);
 }
 
 OperationNode *DepsgraphNodeBuilder::ensure_operation_node(
         ID *id,
         NodeType comp_type,
-        const DepsEvalOperationCb& op,
         OperationCode opcode,
+        const DepsEvalOperationCb& op,
         const char *name,
         int name_tag)
 {
@@ -276,7 +269,7 @@ OperationNode *DepsgraphNodeBuilder::ensure_operation_node(
 	if (operation != NULL) {
 		return operation;
 	}
-	return add_operation_node(id, comp_type, op, opcode, name, name_tag);
+	return add_operation_node(id, comp_type, opcode, op, name, name_tag);
 }
 
 bool DepsgraphNodeBuilder::has_operation_node(ID *id,
@@ -286,12 +279,8 @@ bool DepsgraphNodeBuilder::has_operation_node(ID *id,
                                               const char *name,
                                               int name_tag)
 {
-	return find_operation_node(id,
-	                           comp_type,
-	                           comp_name,
-	                           opcode,
-	                           name,
-	                           name_tag) != NULL;
+	return find_operation_node(
+	        id, comp_type, comp_name, opcode, name, name_tag) != NULL;
 }
 
 OperationNode *DepsgraphNodeBuilder::find_operation_node(
@@ -618,10 +607,8 @@ void DepsgraphNodeBuilder::build_object(int base_index,
 	 * Do it now because it's possible object data will affect
 	 * on object's level animation, for example in case of rebuilding
 	 * pose for proxy. */
-	OperationNode *op_node = add_operation_node(&object->id,
-	                                                NodeType::PARAMETERS,
-	                                                NULL,
-	                                                OperationCode::PARAMETERS_EVAL);
+	OperationNode *op_node = add_operation_node(
+	        &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
 	op_node->set_as_exit();
 	build_animdata(&object->id);
 	/* Particle systems. */
@@ -644,18 +631,16 @@ void DepsgraphNodeBuilder::build_object(int base_index,
 		is_parent_collection_visible_ = is_visible;
 		build_collection(NULL, object->dup_group);
 		is_parent_collection_visible_ = is_current_parent_collection_visible;
-		add_operation_node(&object->id,
-		                   NodeType::DUPLI,
-		                   NULL,
-		                   OperationCode::DUPLI);
+		add_operation_node(
+		        &object->id, NodeType::DUPLI, OperationCode::DUPLI);
 	}
 	/* Syncronization back to original object. */
 	add_operation_node(&object->id,
 	                   NodeType::SYNCHRONIZATION,
+	                   OperationCode::SYNCHRONIZE_TO_ORIGINAL,
 	                   function_bind(BKE_object_synchronize_to_original,
 	                                 _1,
-	                                 object_cow),
-	                   OperationCode::SYNCHRONIZE_TO_ORIGINAL);
+	                                 object_cow));
 }
 
 void DepsgraphNodeBuilder::build_object_flags(
@@ -672,13 +657,13 @@ void DepsgraphNodeBuilder::build_object_flags(
 	/* TODO(sergey): Is this really best component to be used? */
 	add_operation_node(&object->id,
 	                   NodeType::OBJECT_FROM_LAYER,
+	                   OperationCode::OBJECT_BASE_FLAGS,
 	                   function_bind(BKE_object_eval_flush_base_flags,
 	                                 _1,
 	                                 scene_cow,
 	                                 view_layer_index_,
 	                                 object_cow, base_index,
-	                                 is_from_set),
-	                   OperationCode::OBJECT_BASE_FLAGS);
+	                                 is_from_set));
 }
 
 void DepsgraphNodeBuilder::build_object_data(
@@ -745,62 +730,51 @@ void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object)
 {
 	LightProbe *probe = (LightProbe *)object->data;
 	build_lightprobe(probe);
-	add_operation_node(&object->id,
-	                   NodeType::PARAMETERS,
-	                   NULL,
-	                   OperationCode::LIGHT_PROBE_EVAL);
+	add_operation_node(
+	        &object->id, NodeType::PARAMETERS, OperationCode::LIGHT_PROBE_EVAL);
 }
 
 void DepsgraphNodeBuilder::build_object_data_speaker(Object *object)
 {
 	Speaker *speaker = (Speaker *)object->data;
 	build_speaker(speaker);
-	add_operation_node(&object->id,
-	                   NodeType::PARAMETERS,
-	                   NULL,
-	                   OperationCode::SPEAKER_EVAL);
+	add_operation_node(
+	        &object->id, NodeType::PARAMETERS, OperationCode::SPEAKER_EVAL);
 }
 
 void DepsgraphNodeBuilder::build_object_transform(Object *object)
 {
 	OperationNode *op_node;
 	Object *ob_cow = get_cow_datablock(object);
-
-	/* local transforms (from transform channels - loc/rot/scale + deltas) */
+	/* Local transforms (from transform channels - loc/rot/scale + deltas). */
 	op_node = add_operation_node(&object->id, NodeType::TRANSFORM,
+	                             OperationCode::TRANSFORM_LOCAL,
 	                             function_bind(BKE_object_eval_local_transform,
 	                                           _1,
-	                                           ob_cow),
-	                             OperationCode::TRANSFORM_LOCAL);
+	                                           ob_cow));
 	op_node->set_as_entry();
-
-	/* object parent */
+	/* Object parent. */
 	if (object->parent != NULL) {
 		add_operation_node(&object->id, NodeType::TRANSFORM,
-		                   function_bind(BKE_object_eval_parent,
-		                                 _1,
-		                                 ob_cow),
-		                   OperationCode::TRANSFORM_PARENT);
+		                   OperationCode::TRANSFORM_PARENT,
+		                   function_bind(BKE_object_eval_parent, _1, ob_cow));
 	}
-
-	/* object constraints */
+	/* Object constraints. */
 	if (object->constraints.first != NULL) {
 		build_object_constraints(object);
 	}
-
 	/* Rest of transformation update. */
 	add_operation_node(&object->id, NodeType::TRANSFORM,
+	                   OperationCode::TRANSFORM_OBJECT_UBEREVAL,
 	                   function_bind(BKE_object_eval_uber_transform,
 	                                 _1,
-	                                 ob_cow),
-	                   OperationCode::TRANSFORM_OBJECT_UBEREVAL);
-
-	/* object transform is done */
+	                                 ob_cow));
+	/* Object transform is done. */
 	op_node = add_operation_node(&object->id, NodeType::TRANSFORM,
+	                             OperationCode::TRANSFORM_FINAL,
 	                             function_bind(BKE_object_eval_transform_final,
 	                                           _1,
-	                                           ob_cow),
-	                             OperationCode::TRANSFORM_FINAL);
+	                                           ob_cow));
 	op_node->set_as_exit();
 }
 
@@ -825,11 +799,11 @@ void DepsgraphNodeBuilder::build_object_constraints(Object *object)
 {
 	/* create node for constraint stack */
 	add_operation_node(&object->id, NodeType::TRANSFORM,
+	                   OperationCode::TRANSFORM_CONSTRAINTS,
 	                   function_bind(BKE_object_eval_constraints,
 	                                 _1,
 	                                 get_cow_datablock(scene_),
-	                                 get_cow_datablock(object)),
-	                   OperationCode::TRANSFORM_CONSTRAINTS);
+	                                 get_cow_datablock(object)));
 }
 
 void DepsgraphNodeBuilder::build_object_pointcache(Object *object)
@@ -841,11 +815,11 @@ void DepsgraphNodeBuilder::build_object_pointcache(Object *object)
 	Object *object_cow = get_cow_datablock(object);
 	add_operation_node(&object->id,
 	                   NodeType::POINT_CACHE,
+	                   OperationCode::POINT_CACHE_RESET,
 	                   function_bind(BKE_object_eval_ptcache_reset,
 	                                 _1,
 	                                 scene_cow,
-	                                 object_cow),
-	                   OperationCode::POINT_CACHE_RESET);
+	                                 object_c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list