[Bf-blender-cvs] [ef2112e] depsgraph_cleanup: Depsgraph: Wrap everything into DEG namespace

Sergey Sharybin noreply at git.blender.org
Thu May 26 10:02:48 CEST 2016


Commit: ef2112e3c73a9877113bbda6a464b82404b6045e
Author: Sergey Sharybin
Date:   Thu May 26 09:18:07 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rBef2112e3c73a9877113bbda6a464b82404b6045e

Depsgraph: Wrap everything into DEG namespace

Some areas are nto so pretty looking atm, but there are not so much
of them for now. And we can easily solve that by making it so public
API simply calls an inlined function from DEG namespace.

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

M	source/blender/depsgraph/intern/builder/deg_builder.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_relations.h
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
M	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/depsgraph_query.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/depsgraph_type_defines.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
M	source/blender/depsgraph/intern/eval/deg_eval.h
M	source/blender/depsgraph/intern/eval/deg_eval_debug.h
M	source/blender/depsgraph/intern/eval/deg_eval_flush.h
M	source/blender/depsgraph/intern/nodes/deg_node.cc
M	source/blender/depsgraph/intern/nodes/deg_node.h
M	source/blender/depsgraph/intern/nodes/deg_node_component.cc
M	source/blender/depsgraph/intern/nodes/deg_node_component.h
M	source/blender/depsgraph/intern/nodes/deg_node_operation.cc
M	source/blender/depsgraph/intern/nodes/deg_node_operation.h
M	source/blender/depsgraph/util/depsgraph_util_cycle.h
M	source/blender/depsgraph/util/depsgraph_util_transitive.h

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder.h b/source/blender/depsgraph/intern/builder/deg_builder.h
index c46fb28..2fb3c57 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder.h
@@ -32,15 +32,15 @@
 
 #include "depsgraph_types.h"
 
-class Depsgraph;
-
 struct FCurve;
 
 namespace DEG {
 
+struct Depsgraph;
+
 /* Get unique identifier for FCurves and Drivers */
 string deg_fcurve_id_name(const FCurve *fcu);
 
-void deg_graph_build_finalize(class Depsgraph *graph);
+void deg_graph_build_finalize(struct Depsgraph *graph);
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 62ba57d..202a972 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -347,7 +347,7 @@ SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
 		return NULL;
 
 	/* create new subgraph's data */
-	Depsgraph *subgraph = DEG_graph_new();
+	Depsgraph *subgraph = reinterpret_cast<Depsgraph *>(DEG_graph_new());
 
 	DepsgraphNodeBuilder subgraph_builder(m_bmain, subgraph);
 
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 4e819b5..cce0437 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -53,9 +53,10 @@ struct World;
 
 struct PropertyRNA;
 
+namespace DEG {
+
 struct Depsgraph;
 struct DepsNode;
-struct DepsNodeHandle;
 struct RootDepsNode;
 struct SubgraphDepsNode;
 struct IDDepsNode;
@@ -63,8 +64,6 @@ struct TimeSourceDepsNode;
 struct ComponentDepsNode;
 struct OperationDepsNode;
 
-namespace DEG {
-
 struct DepsgraphNodeBuilder {
 	DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph);
 	~DepsgraphNodeBuilder();
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 391326c..3209f7b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -67,18 +67,17 @@ struct World;
 
 struct PropertyRNA;
 
+namespace DEG {
+
 struct Depsgraph;
 struct DepsNode;
+struct DepsNodeHandle;
 struct RootDepsNode;
 struct SubgraphDepsNode;
 struct IDDepsNode;
 struct TimeSourceDepsNode;
 struct ComponentDepsNode;
 struct OperationDepsNode;
-
-namespace DEG {
-
-struct DepsNodeHandle;
 struct RootPChanMap;
 
 struct RootKey
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 994a564..f394189 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -59,6 +59,8 @@ extern "C" {
 #include "depsgraph_intern.h"
 #include "depsgraph_util_foreach.h"
 
+namespace DEG {
+
 static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL;
 static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = NULL;
 static DEG_EditorUpdateScenePreCb deg_editor_update_scene_pre_cb = NULL;
@@ -462,19 +464,38 @@ void Depsgraph::clear_all_nodes()
 	}
 }
 
+void deg_editors_id_update(Main *bmain, ID *id)
+{
+	if (deg_editor_update_id_cb != NULL) {
+		deg_editor_update_id_cb(bmain, id);
+	}
+}
+
+void deg_editors_scene_update(Main *bmain, Scene *scene, bool updated)
+{
+	if (deg_editor_update_scene_cb != NULL) {
+		deg_editor_update_scene_cb(bmain, scene, updated);
+	}
+}
+
+}  // namespace DEG
+
 /* **************** */
 /* Public Graph API */
 
 /* Initialize a new Depsgraph */
 Depsgraph *DEG_graph_new()
 {
-	return OBJECT_GUARDED_NEW(Depsgraph);
+	DEG::Depsgraph *deg_depsgraph = OBJECT_GUARDED_NEW(DEG::Depsgraph);
+	return reinterpret_cast<Depsgraph *>(deg_depsgraph);
 }
 
 /* Free graph's contents and graph itself */
 void DEG_graph_free(Depsgraph *graph)
 {
-	OBJECT_GUARDED_DELETE(graph, Depsgraph);
+	using DEG::Depsgraph;
+	DEG::Depsgraph *deg_depsgraph = reinterpret_cast<DEG::Depsgraph *>(graph);
+	OBJECT_GUARDED_DELETE(deg_depsgraph, Depsgraph);
 }
 
 /* Set callbacks which are being called when depsgraph changes. */
@@ -482,28 +503,14 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
                                DEG_EditorUpdateSceneCb scene_func,
                                DEG_EditorUpdateScenePreCb scene_pre_func)
 {
-	deg_editor_update_id_cb = id_func;
-	deg_editor_update_scene_cb = scene_func;
-	deg_editor_update_scene_pre_cb = scene_pre_func;
+	DEG::deg_editor_update_id_cb = id_func;
+	DEG::deg_editor_update_scene_cb = scene_func;
+	DEG::deg_editor_update_scene_pre_cb = scene_pre_func;
 }
 
 void DEG_editors_update_pre(Main *bmain, Scene *scene, bool time)
 {
-	if (deg_editor_update_scene_pre_cb != NULL) {
-		deg_editor_update_scene_pre_cb(bmain, scene, time);
-	}
-}
-
-void deg_editors_id_update(Main *bmain, ID *id)
-{
-	if (deg_editor_update_id_cb != NULL) {
-		deg_editor_update_id_cb(bmain, id);
-	}
-}
-
-void deg_editors_scene_update(Main *bmain, Scene *scene, bool updated)
-{
-	if (deg_editor_update_scene_cb != NULL) {
-		deg_editor_update_scene_cb(bmain, scene, updated);
+	if (DEG::deg_editor_update_scene_pre_cb != NULL) {
+		DEG::deg_editor_update_scene_pre_cb(bmain, scene, time);
 	}
 }
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 4f2deb5..094867c 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -46,6 +46,8 @@
 struct PointerRNA;
 struct PropertyRNA;
 
+namespace DEG {
+
 struct DepsNode;
 struct RootDepsNode;
 struct TimeSourceDepsNode;
@@ -196,3 +198,5 @@ struct Depsgraph {
 
 	// XXX: additional stuff like eval contexts, mempools for allocating nodes from, etc.
 };
+
+}  // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index fb6b795..ba97ee1 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -63,32 +63,32 @@ extern "C" {
 /* ****************** */
 /* External Build API */
 
-static eDepsNode_Type deg_build_scene_component_type(
+static DEG::eDepsNode_Type deg_build_scene_component_type(
         eDepsSceneComponentType component)
 {
 	switch (component) {
-		case DEG_SCENE_COMP_PARAMETERS:     return DEPSNODE_TYPE_PARAMETERS;
-		case DEG_SCENE_COMP_ANIMATION:      return DEPSNODE_TYPE_ANIMATION;
-		case DEG_SCENE_COMP_SEQUENCER:      return DEPSNODE_TYPE_SEQUENCER;
+		case DEG_SCENE_COMP_PARAMETERS:     return DEG::DEPSNODE_TYPE_PARAMETERS;
+		case DEG_SCENE_COMP_ANIMATION:      return DEG::DEPSNODE_TYPE_ANIMATION;
+		case DEG_SCENE_COMP_SEQUENCER:      return DEG::DEPSNODE_TYPE_SEQUENCER;
 	}
-	return DEPSNODE_TYPE_UNDEFINED;
+	return DEG::DEPSNODE_TYPE_UNDEFINED;
 }
 
-static eDepsNode_Type deg_build_object_component_type(
+static DEG::eDepsNode_Type deg_build_object_component_type(
         eDepsObjectComponentType component)
 {
 	switch (component) {
-		case DEG_OB_COMP_PARAMETERS:        return DEPSNODE_TYPE_PARAMETERS;
-		case DEG_OB_COMP_PROXY:             return DEPSNODE_TYPE_PROXY;
-		case DEG_OB_COMP_ANIMATION:         return DEPSNODE_TYPE_ANIMATION;
-		case DEG_OB_COMP_TRANSFORM:         return DEPSNODE_TYPE_TRANSFORM;
-		case DEG_OB_COMP_GEOMETRY:          return DEPSNODE_TYPE_GEOMETRY;
-		case DEG_OB_COMP_EVAL_POSE:         return DEPSNODE_TYPE_EVAL_POSE;
-		case DEG_OB_COMP_BONE:              return DEPSNODE_TYPE_BONE;
-		case DEG_OB_COMP_EVAL_PARTICLES:    return DEPSNODE_TYPE_EVAL_PARTICLES;
-		case DEG_OB_COMP_SHADING:           return DEPSNODE_TYPE_SHADING;
+		case DEG_OB_COMP_PARAMETERS:        return DEG::DEPSNODE_TYPE_PARAMETERS;
+		case DEG_OB_COMP_PROXY:             return DEG::DEPSNODE_TYPE_PROXY;
+		case DEG_OB_COMP_ANIMATION:         return DEG::DEPSNODE_TYPE_ANIMATION;
+		case DEG_OB_COMP_TRANSFORM:         return DEG::DEPSNODE_TYPE_TRANSFORM;
+		case DEG_OB_COMP_GEOMETRY:          return DEG::DEPSNODE_TYPE_GEOMETRY;
+		case DEG_OB_COMP_EVAL_POSE:         return DEG::DEPSNODE_TYPE_EVAL_POSE;
+		case DEG_OB_COMP_BONE:              return DEG::DEPSNODE_TYPE_BONE;
+		case DEG_OB_COMP_EVAL_PARTICLES:    return DEG::DEPSNODE_TYPE_EVAL_PARTICLES;
+		case DEG_OB_COMP_SHADING:           return DEG::DEPSNODE_TYPE_SHADING;
 	}
-	return DEPSNODE_TYPE_UNDEFINED;
+	return DEG::DEPSNODE_TYPE_UNDEFINED;
 }
 
 static DEG::DepsNodeHandle *get_handle(DepsNodeHandle *handle)
@@ -101,12 +101,12 @@ void DEG_add_scene_relation(DepsNodeHandle *handle,
                             eDepsSceneComponentType component,
                             const char *description)
 {
-	eDepsNode_Type type = deg_build_scene_component_type(component);
+	DEG::eDepsNode_Type type = deg_build_scene_component_type(component);
 	DEG::ComponentKey comp_key(&scene->id, type);
 	DEG::DepsNodeHandle *deg_handle = get_handle(handle);
 	deg_handle->builder->add_node_handle_relation(comp_key,
 	                                              deg_handle,
-	                                              DEPSREL_TYPE_GEOMETRY_EVAL,
+	                                              DEG::DEPSREL_TYPE_GEOMETRY_EVAL,
 	                                              description);
 }
 
@@ -115,12 +115,12 @@ void DEG_add_object_relation(DepsNodeHandle *handle,
                              eDepsObjectComponentType component,
                              const char *description)
 {
-	eDepsNode_Type type = deg_build_object_component_type(component);
+	DEG::eDepsNode_Type type = deg_build_object_component_type(component);
 	DEG::ComponentKey comp_key(&ob->id, type);
 	DEG::DepsNodeHandle *deg_handle = get_handle(handle);
 	deg_handle->builder->add_node_handle_relation(comp_key,
 	                                              deg_handle,
-	                                              DEPSREL_TYPE_GEOMETRY_EVAL,
+	                                              DEG::DEPSREL_TYPE_GEOMETRY_EVAL,
 	                                              description);
 }
 
@@ -130,7 +13

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list