[Bf-blender-cvs] [c1da8e3b28f] master: Depsgraph: Comb code to a better state all over

Sergey Sharybin noreply at git.blender.org
Thu Jan 31 14:34:56 CET 2019


Commit: c1da8e3b28f95188f9e9152383856c95f29586b4
Author: Sergey Sharybin
Date:   Thu Jan 31 12:56:40 2019 +0100
Branches: master
https://developer.blender.org/rBc1da8e3b28f95188f9e9152383856c95f29586b4

Depsgraph: Comb code to a better state all over

Some summary of changes:

- Don't use DEG prefix for types and enumerator values:
  the code is already inside DEG namespace.

- Put code where it locally belongs to: avoid having one
  single header file with all sort of definitions in it.

- Take advantage of modern C++11 enabled by default.

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

M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/DEG_depsgraph.h
M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/DEG_depsgraph_query.h
M	source/blender/depsgraph/intern/builder/deg_builder.cc
M	source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
M	source/blender/depsgraph/intern/builder/deg_builder_map.h
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
M	source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
M	source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.h
M	source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
M	source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
M	source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
A	source/blender/depsgraph/intern/debug/deg_debug.cc
A	source/blender/depsgraph/intern/debug/deg_debug.h
M	source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
M	source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
M	source/blender/depsgraph/intern/depsgraph.cc
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_build.cc
M	source/blender/depsgraph/intern/depsgraph_debug.cc
M	source/blender/depsgraph/intern/depsgraph_eval.cc
D	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/depsgraph_physics.cc
R062	source/blender/depsgraph/util/deg_util_foreach.h	source/blender/depsgraph/intern/depsgraph_physics.h
M	source/blender/depsgraph/intern/depsgraph_query.cc
M	source/blender/depsgraph/intern/depsgraph_query_filter.cc
M	source/blender/depsgraph/intern/depsgraph_query_foreach.cc
M	source/blender/depsgraph/intern/depsgraph_query_iter.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc
A	source/blender/depsgraph/intern/depsgraph_tag.h
A	source/blender/depsgraph/intern/depsgraph_type.cc
A	source/blender/depsgraph/intern/depsgraph_type.h
D	source/blender/depsgraph/intern/depsgraph_type_defines.cc
D	source/blender/depsgraph/intern/depsgraph_types.h
A	source/blender/depsgraph/intern/depsgraph_update.cc
R065	source/blender/depsgraph/util/deg_util_function.h	source/blender/depsgraph/intern/depsgraph_update.h
M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M	source/blender/depsgraph/intern/eval/deg_eval_stats.cc
A	source/blender/depsgraph/intern/node/deg_node.cc
A	source/blender/depsgraph/intern/node/deg_node.h
R064	source/blender/depsgraph/intern/nodes/deg_node_component.cc	source/blender/depsgraph/intern/node/deg_node_component.cc
R072	source/blender/depsgraph/intern/nodes/deg_node_component.h	source/blender/depsgraph/intern/node/deg_node_component.h
A	source/blender/depsgraph/intern/node/deg_node_factory.cc
A	source/blender/depsgraph/intern/node/deg_node_factory.h
A	source/blender/depsgraph/intern/node/deg_node_factory_impl.h
R066	source/blender/depsgraph/intern/nodes/deg_node_id.cc	source/blender/depsgraph/intern/node/deg_node_id.cc
R074	source/blender/depsgraph/intern/nodes/deg_node_id.h	source/blender/depsgraph/intern/node/deg_node_id.h
A	source/blender/depsgraph/intern/node/deg_node_operation.cc
A	source/blender/depsgraph/intern/node/deg_node_operation.h
R077	source/blender/depsgraph/intern/nodes/deg_node_time.cc	source/blender/depsgraph/intern/node/deg_node_time.cc
R091	source/blender/depsgraph/intern/nodes/deg_node_time.h	source/blender/depsgraph/intern/node/deg_node_time.h
D	source/blender/depsgraph/intern/nodes/deg_node.cc
D	source/blender/depsgraph/intern/nodes/deg_node.h
D	source/blender/depsgraph/intern/nodes/deg_node_operation.cc
D	source/blender/depsgraph/intern/nodes/deg_node_operation.h

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

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 884f1d272a5..042388a6250 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -53,17 +53,19 @@ set(SRC
 	intern/builder/deg_builder_relations_rig.cc
 	intern/builder/deg_builder_relations_view_layer.cc
 	intern/builder/deg_builder_transitive.cc
+	intern/debug/deg_debug.cc
 	intern/debug/deg_debug_relations_graphviz.cc
 	intern/debug/deg_debug_stats_gnuplot.cc
 	intern/eval/deg_eval.cc
 	intern/eval/deg_eval_copy_on_write.cc
 	intern/eval/deg_eval_flush.cc
 	intern/eval/deg_eval_stats.cc
-	intern/nodes/deg_node.cc
-	intern/nodes/deg_node_component.cc
-	intern/nodes/deg_node_id.cc
-	intern/nodes/deg_node_operation.cc
-	intern/nodes/deg_node_time.cc
+	intern/node/deg_node.cc
+	intern/node/deg_node_component.cc
+	intern/node/deg_node_factory.cc
+	intern/node/deg_node_id.cc
+	intern/node/deg_node_operation.cc
+	intern/node/deg_node_time.cc
 	intern/depsgraph.cc
 	intern/depsgraph_build.cc
 	intern/depsgraph_debug.cc
@@ -74,7 +76,8 @@ set(SRC
 	intern/depsgraph_query_foreach.cc
 	intern/depsgraph_query_iter.cc
 	intern/depsgraph_tag.cc
-	intern/depsgraph_type_defines.cc
+	intern/depsgraph_type.cc
+	intern/depsgraph_update.cc
 
 	DEG_depsgraph.h
 	DEG_depsgraph_build.h
@@ -90,21 +93,23 @@ set(SRC
 	intern/builder/deg_builder_relations.h
 	intern/builder/deg_builder_relations_impl.h
 	intern/builder/deg_builder_transitive.h
+	intern/debug/deg_debug.h
 	intern/eval/deg_eval.h
 	intern/eval/deg_eval_copy_on_write.h
 	intern/eval/deg_eval_flush.h
 	intern/eval/deg_eval_stats.h
-	intern/nodes/deg_node.h
-	intern/nodes/deg_node_component.h
-	intern/nodes/deg_node_id.h
-	intern/nodes/deg_node_operation.h
-	intern/nodes/deg_node_time.h
+	intern/node/deg_node.h
+	intern/node/deg_node_component.h
+	intern/node/deg_node_factory.h
+	intern/node/deg_node_factory_impl.h
+	intern/node/deg_node_id.h
+	intern/node/deg_node_operation.h
+	intern/node/deg_node_time.h
 	intern/depsgraph.h
-	intern/depsgraph_intern.h
-	intern/depsgraph_types.h
-
-	util/deg_util_foreach.h
-	util/deg_util_function.h
+	intern/depsgraph_physics.h
+	intern/depsgraph_tag.h
+	intern/depsgraph_type.h
+	intern/depsgraph_update.h
 )
 
 if(WITH_BOOST)
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 410f5554069..31a9c7a8a6b 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -79,12 +79,10 @@ typedef enum eEvaluationMode {
 enum {
 	/* Regardless to curve->path animation flag path is to be evaluated anyway,
 	 * to meet dependencies with such a things as curve modifier and other guys
-	 * who're using curve deform, where_on_path and so.
-	 */
+	 * who're using curve deform, where_on_path and so. */
 	DAG_EVAL_NEED_CURVE_PATH = (1 << 0),
 	/* A shrinkwrap modifier or constraint targeting this mesh needs information
-	 * about non-manifold boundary edges for the Target Normal Project mode.
-	 */
+	 * about non-manifold boundary edges for the Target Normal Project mode. */
 	DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY = (1 << 1),
 };
 
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index d783e49dd29..a6b19e8a314 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -89,12 +89,10 @@ struct DepsNodeHandle;
 
 typedef enum eDepsSceneComponentType {
 	/* Parameters Component - Default when nothing else fits
-	 * (i.e. just SDNA property setting).
-	 */
+	 * (i.e. just SDNA property setting). */
 	DEG_SCENE_COMP_PARAMETERS,
 	/* Animation Component
-	 * TODO(sergey): merge in with parameters?
-	 */
+	 * TODO(sergey): merge in with parameters?  */
 	DEG_SCENE_COMP_ANIMATION,
 	/* Sequencer Component (Scene Only). */
 	DEG_SCENE_COMP_SEQUENCER,
@@ -102,17 +100,14 @@ typedef enum eDepsSceneComponentType {
 
 typedef enum eDepsObjectComponentType {
 	/* Parameters Component - Default when nothing else fits
-	 * (i.e. just SDNA property setting).
-	 */
+	 * (i.e. just SDNA property setting). */
 	DEG_OB_COMP_PARAMETERS,
 	/* Generic "Proxy-Inherit" Component.
-	 * TODO(sergey): Also for instancing of subgraphs?
-	 */
+	 * TODO(sergey): Also for instancing of subgraphs? */
 	DEG_OB_COMP_PROXY,
 	/* Animation Component.
 	 *
-	 * TODO(sergey): merge in with parameters?
-	 */
+	 * TODO(sergey): merge in with parameters? */
 	DEG_OB_COMP_ANIMATION,
 	/* Transform Component (Parenting/Constraints) */
 	DEG_OB_COMP_TRANSFORM,
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 46a9d2c5d72..423072994e9 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -129,12 +129,10 @@ typedef struct DEGObjectIterData {
 	/* Next duplicated object to step into. */
 	struct DupliObject *dupli_object_next;
 	/* Corresponds to current object: current iterator object is evaluated from
-	 * this duplicated object.
-	 */
+	 * this duplicated object. */
 	struct DupliObject *dupli_object_current;
 	/* Temporary storage to report fully populated DNA to the render engine or
-	 * other users of the iterator.
-	 */
+	 * other users of the iterator. */
 	struct Object temp_dupli_object;
 
 	/* **** Iteration over ID nodes **** */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc
index 97e7c8654bd..dd2aec35a3e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@ -43,15 +43,13 @@ extern "C" {
 }
 
 #include "intern/depsgraph.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/depsgraph_types.h"
+#include "intern/depsgraph_tag.h"
+#include "intern/depsgraph_type.h"
 #include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
 
 #include "DEG_depsgraph.h"
 
@@ -65,21 +63,21 @@ void deg_graph_build_flush_visibility(Depsgraph *graph)
 		DEG_NODE_VISITED = (1 << 0),
 	};
 
-	BLI_Stack *stack = BLI_stack_new(sizeof(OperationDepsNode *),
+	BLI_Stack *stack = BLI_stack_new(sizeof(OperationNode *),
 	                                 "DEG flush layers stack");
-	foreach (IDDepsNode *id_node, graph->id_nodes) {
-		GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+	for (IDNode *id_node : graph->id_nodes) {
+		GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
 		{
 			comp_node->affects_directly_visible |= id_node->is_directly_visible;
 		}
 		GHASH_FOREACH_END();
 	}
-	foreach (OperationDepsNode *op_node, graph->operations) {
+	for (OperationNode *op_node : graph->operations) {
 		op_node->custom_flags = 0;
 		op_node->num_links_pending = 0;
-		foreach (DepsRelation *rel, op_node->outlinks) {
-			if ((rel->from->type == DEG_NODE_TYPE_OPERATION) &&
-			    (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
+		for (Relation *rel : op_node->outlinks) {
+			if ((rel->from->type == NodeType::OPERATION) &&
+			    (rel->flag & RELATION_FLAG_CYCLIC) == 0)
 			{
 				++op_node->num_links_pending;
 			}
@@ -90,21 +88,21 @@ void deg_graph_build_flush_visibility(Depsgraph *graph)
 		}
 	}
 	while (!BLI_stack_is_empty(stack)) {
-		OperationDepsNode *op_node;
+		OperationNode *op_node;
 		BLI_stack_pop(stack, &op_node);
 		/* Flush layers to parents. */
-		foreach (DepsRelation *rel, op_node->inlinks) {
-			if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
-				OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
+		for (Relation *rel : op_node->inlinks) {
+			if (rel->from->type == NodeType::OPERATION) {
+				OperationNode *op_from = (OperationNode *)rel->from;
 				op_from->owner->affects_directly_visible |=
 				        op_node->owner->affects_directly_visible;
 			}
 		}
 		/* Schedule parent nodes. */
-		foreach (DepsRelation *rel, op_node->inlinks) {
-			if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
-				OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
-				if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) {
+		for (Relation *rel : op_node->inlinks) {
+			if (rel->from->type == NodeType::OPERATION) {
+				OperationNode *op_from = (OperationNode *)rel->from;
+				if ((rel->flag & RELATION_FLAG_CYCLIC) == 0) {
 					BLI_assert(op_from->num_links_pending > 0);
 					--op_from->num_links_pending;
 				}
@@ -127,9 +125,8 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
 	/* Make sure dependencies of visible ID datablocks are visible. */
 	deg_graph_build_flush_visibility(graph);
 	/* Re-tag IDs for update if it was tagged before the relations
-	 * update tag.
-	 */
-	foreach (IDDepsNode *id_node, graph->id_nodes) {
+	 * update tag. */
+	for (IDNode *id_node : graph->id_nodes) {
 		ID *id = id_node->id_orig;
 		id_node->finalize_build(graph);
 		int flag = 0;
@@ -144,18 +141,17 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
 		if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
 			flag |= ID_RECALC_COPY_ON_WRITE;
 			/* This means ID is being added to the dependency graph first
-			 * time, which is similar to "ob-visible-change"
-			 */
+			 * time, which is similar to "ob-visible-change" */
 			if (GS(id->name) == ID_OB) {
 				flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
 			}
 		}
 		if (flag != 0) {
-			deg_graph_id_tag_update(bmain,
-			                        graph,
-			                        id_node->id_orig,
-			                        flag,
-			                        DEG_UPDATE_SOURCE_RELATIONS);
+			graph_id_tag_update(bmain,
+			                    graph,
+			                    id_node->id_orig,
+			                    flag,
+			                    DEG_UPDATE_SOURCE_RELATIONS);
 		}
 	}
 }
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/ble

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list