[Bf-blender-cvs] [50f5f0957c4] blender2.8: Depsgraph: Cleanup, de-duplicate couple of utility functions

Sergey Sharybin noreply at git.blender.org
Wed Jul 19 17:33:46 CEST 2017


Commit: 50f5f0957c400595a85889ea9f6777e1a861dd21
Author: Sergey Sharybin
Date:   Tue Jul 18 12:43:22 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB50f5f0957c400595a85889ea9f6777e1a861dd21

Depsgraph: Cleanup, de-duplicate couple of utility functions

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

M	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
index 2d8e7dc841c..ad55c219dc7 100644
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@ -113,6 +113,11 @@ void deg_editors_id_update(struct Main *bmain, struct ID *id);
 
 void deg_editors_scene_update(struct Main *bmain, struct Scene *scene, bool updated);
 
+/* Tagging helpers ------------------------------------------------------ */
+
+void lib_id_recalc_tag(struct Main *bmain, struct ID *id);
+void lib_id_recalc_data_tag(struct Main *bmain, struct ID *id);
+
 #define DEG_DEBUG_PRINTF(...) \
 	do { \
 		if (G.debug & G_DEBUG_DEPSGRAPH) { \
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index c293e0a708f..17d7cbf5187 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -70,7 +70,7 @@ extern "C" {
 /* *********************** */
 /* Update Tagging/Flushing */
 
-namespace {
+namespace DEG {
 
 /* Data-Based Tagging ------------------------------- */
 
@@ -86,6 +86,8 @@ void lib_id_recalc_data_tag(Main *bmain, ID *id)
 	DEG_id_type_tag(bmain, GS(id->name));
 }
 
+namespace {
+
 void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
 {
 	if (flag) {
@@ -122,18 +124,20 @@ void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
 void id_tag_copy_on_write_update(Main *bmain, Depsgraph *graph, ID *id)
 {
 	lib_id_recalc_tag(bmain, id);
-	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
-	DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
-	DEG::ComponentDepsNode *cow_comp =
+	Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
+	IDDepsNode *id_node = deg_graph->find_id_node(id);
+	ComponentDepsNode *cow_comp =
 	        id_node->find_component(DEG::DEG_NODE_TYPE_COPY_ON_WRITE);
-	DEG::OperationDepsNode *cow_node = cow_comp->get_entry_operation();
+	OperationDepsNode *cow_node = cow_comp->get_entry_operation();
 	cow_node->tag_update(deg_graph);
-	cow_node->flag |= DEG::DEPSOP_FLAG_SKIP_FLUSH;
+	cow_node->flag |= DEPSOP_FLAG_SKIP_FLUSH;
 }
 #endif
 
 }  /* namespace */
 
+}  // namespace DEG
+
 /* Tag all nodes in ID-block for update.
  * This is a crude measure, but is most convenient for old code.
  */
@@ -141,7 +145,7 @@ void DEG_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id)
 {
 	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
 	DEG::IDDepsNode *node = deg_graph->find_id_node(id);
-	lib_id_recalc_tag(bmain, id);
+	DEG::lib_id_recalc_tag(bmain, id);
 	if (node != NULL) {
 		node->tag_update(deg_graph);
 	}
@@ -160,7 +164,7 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag)
 		return;
 	}
 	DEG_DEBUG_PRINTF("%s: id=%s flag=%d\n", __func__, id->name, flag);
-	lib_id_recalc_tag_flag(bmain, id, flag);
+	DEG::lib_id_recalc_tag_flag(bmain, id, flag);
 	for (Scene *scene = (Scene *)bmain->scene.first;
 	     scene != NULL;
 	     scene = (Scene *)scene->id.next)
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 605ca990e07..8c79c611fe0 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -54,23 +54,6 @@ extern "C" {
 
 namespace DEG {
 
-namespace {
-
-// TODO(sergey): De-duplicate with depsgraph_tag,cc
-void lib_id_recalc_tag(Main *bmain, ID *id)
-{
-	id->tag |= LIB_TAG_ID_RECALC;
-	DEG_id_type_tag(bmain, GS(id->name));
-}
-
-void lib_id_recalc_data_tag(Main *bmain, ID *id)
-{
-	id->tag |= LIB_TAG_ID_RECALC_DATA;
-	DEG_id_type_tag(bmain, GS(id->name));
-}
-
-}  /* namespace */
-
 typedef std::deque<OperationDepsNode *> FlushQueue;
 
 static void flush_init_func(void *data_v, int i)




More information about the Bf-blender-cvs mailing list