[Bf-blender-cvs] [bb75c4cbe9f] blender2.8: Depsgraph: Make all print messages to respect per-depsgraph debug flags

Sergey Sharybin noreply at git.blender.org
Wed May 2 17:10:52 CEST 2018


Commit: bb75c4cbe9f54b643106a999a077d64b20f6d97a
Author: Sergey Sharybin
Date:   Wed May 2 11:52:49 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBbb75c4cbe9f54b643106a999a077d64b20f6d97a

Depsgraph: Make all print messages to respect per-depsgraph debug flags

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

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
M	source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
M	source/blender/depsgraph/intern/depsgraph_build.cc
M	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c862b0e7af4..8eb4d502410 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -251,7 +251,8 @@ DepsRelation *DepsgraphRelationBuilder::add_time_relation(
 		return graph_->add_new_relation(timesrc, node_to, description, check_unique);
 	}
 	else {
-		DEG_DEBUG_PRINTF(BUILD, "add_time_relation(%p = %s, %p = %s, %s) Failed\n",
+		DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
+		                 BUILD, "add_time_relation(%p = %s, %p = %s, %s) Failed\n",
 		                 timesrc,   (timesrc) ? timesrc->identifier().c_str() : "<None>",
 		                 node_to,   (node_to) ? node_to->identifier().c_str() : "<None>",
 		                 description);
@@ -272,7 +273,8 @@ DepsRelation *DepsgraphRelationBuilder::add_operation_relation(
 		                                check_unique);
 	}
 	else {
-		DEG_DEBUG_PRINTF(BUILD, "add_operation_relation(%p = %s, %p = %s, %s) Failed\n",
+		DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
+		                 BUILD, "add_operation_relation(%p = %s, %p = %s, %s) Failed\n",
 		                 node_from, (node_from) ? node_from->identifier().c_str() : "<None>",
 		                 node_to,   (node_to)   ? node_to->identifier().c_str() : "<None>",
 		                 description);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index c80e0d568f3..126aa85edd3 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -176,7 +176,8 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
 		}
 	}
 
-	DEG_DEBUG_PRINTF(BUILD, "\nStarting IK Build: pchan = %s, target = (%s, %s), segcount = %d\n",
+	DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
+	                 BUILD, "\nStarting IK Build: pchan = %s, target = (%s, %s), segcount = %d\n",
 	                 pchan->name, data->tar->id.name, data->subtarget, data->rootbone);
 
 	bPoseChannel *parchan = pchan;
@@ -219,7 +220,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
 		root_map->add_bone(parchan->name, rootchan->name);
 
 		/* continue up chain, until we reach target number of items... */
-		DEG_DEBUG_PRINTF(BUILD, "  %d = %s\n", segcount, parchan->name);
+		DEG_DEBUG_PRINTF((::Depsgraph *)graph_, BUILD, "  %d = %s\n", segcount, parchan->name);
 		segcount++;
 		if ((segcount == data->rootbone) || (segcount > 255)) break;  /* 255 is weak */
 
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
index 12760cad73c..17e64c5f685 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
@@ -117,7 +117,7 @@ void deg_graph_transitive_reduction(Depsgraph *graph)
 			}
 		}
 	}
-	DEG_DEBUG_PRINTF(BUILD, "Removed %d relations\n", num_removed_relations);
+	DEG_DEBUG_PRINTF((::Depsgraph *)graph, BUILD, "Removed %d relations\n", num_removed_relations);
 }
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 0a958fa67d3..a827e428fdf 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -276,6 +276,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
 /* Tag graph relations for update. */
 void DEG_graph_tag_relations_update(Depsgraph *graph)
 {
+	DEG_DEBUG_PRINTF(graph, TAG, "%s: Tagging relations for update.\n", __func__);
 	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
 	deg_graph->need_update = true;
 	/* NOTE: When relations are updated, it's quite possible that
@@ -310,7 +311,7 @@ void DEG_graph_relations_update(Depsgraph *graph,
 /* Tag all relations for update. */
 void DEG_relations_tag_update(Main *bmain)
 {
-	DEG_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
+	DEG_GLOBAL_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
 	LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
 		LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
 			Depsgraph *depsgraph =
diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
index 9961723ed17..dda482efc8d 100644
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@ -46,6 +46,8 @@ extern "C" {
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/depsgraph.h"
 
+#include "DEG_depsgraph_debug.h"
+
 struct DEGEditorUpdateContext;
 struct Group;
 struct Main;
@@ -112,7 +114,14 @@ void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
 void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
                               bool updated);
 
-#define DEG_DEBUG_PRINTF(type, ...) \
+#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
+	do { \
+		if (DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
+			fprintf(stderr, __VA_ARGS__); \
+		} \
+	} while (0)
+
+#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
 	do { \
 		if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
 			fprintf(stderr, __VA_ARGS__); \
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 2778dadcb6e..02f10130fed 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -239,7 +239,8 @@ void flush_editors_id_update(Main *bmain,
 			id_cow->recalc |= factory->id_recalc_tag();
 		}
 		GHASH_FOREACH_END();
-		DEG_DEBUG_PRINTF(EVAL, "Accumulated recalc bits for %s: %u\n",
+		DEG_DEBUG_PRINTF((::Depsgraph *)graph,
+		                 EVAL, "Accumulated recalc bits for %s: %u\n",
 		                 id_orig->name, (unsigned int)id_cow->recalc);
 		/* Inform editors. */
 		if (deg_copy_on_write_is_expanded(id_cow)) {



More information about the Bf-blender-cvs mailing list