[Bf-blender-cvs] [1c7b19a] depsgraph_refactor: Depsgraph: Move debug prints into G_DEBUG_DEPSGRAPH check
Sergey Sharybin
noreply at git.blender.org
Mon Jan 5 19:19:18 CET 2015
Commit: 1c7b19aac5511348a3868630d63803a43c085dfe
Author: Sergey Sharybin
Date: Mon Jan 5 23:16:23 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB1c7b19aac5511348a3868630d63803a43c085dfe
Depsgraph: Move debug prints into G_DEBUG_DEPSGRAPH check
The idea is the following:
- All debug prints in depsgraph/ now uses dag_debug_printf,
which takes care of checking debug flags.
- This function is only intended to be used for informative prints,
all the error messages (like missing node when adding relation)
are still to be done inconditionally to stderr.
===================================================================
M source/blender/blenkernel/intern/object_update.c
M source/blender/depsgraph/intern/depsgraph_build.cpp
M source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M source/blender/depsgraph/intern/depsgraph_debug.cpp
M source/blender/depsgraph/intern/depsgraph_debug.h
M source/blender/depsgraph/intern/depsgraph_type_defines.cpp
===================================================================
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 895ad29..50cd1dc 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -60,16 +60,16 @@
#include "DEG_depsgraph.h"
#ifdef WITH_LEGACY_DEPSGRAPH
-# define PRINT if (DEG_get_eval_mode() == DEG_EVAL_MODE_NEW) printf
+# define DEBUG_PRINT if (DEG_get_eval_mode() == DEG_EVAL_MODE_NEW && G.debug & G_DEBUG_DEPSGRAPH) printf
#else
-# define PRINT printf
+# define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
#endif
void BKE_object_eval_local_transform(EvaluationContext *UNUSED(eval_ctx),
Scene *UNUSED(scene),
Object *ob)
{
- PRINT("%s on %s\n", __func__, ob->id.name);
+ DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
/* calculate local matrix */
BKE_object_to_mat4(ob, ob->obmat);
@@ -88,7 +88,7 @@ void BKE_object_eval_parent(EvaluationContext *UNUSED(eval_ctx), Scene *scene, O
float tmat[4][4];
float locmat[4][4];
- PRINT("%s on %s\n", __func__, ob->id.name);
+ DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
/* get local matrix (but don't calculate it, as that was done already!) */
// XXX: redundant?
@@ -117,7 +117,7 @@ void BKE_object_eval_constraints(EvaluationContext *UNUSED(eval_ctx),
bConstraintOb *cob;
float ctime = BKE_scene_frame_get(scene);
- PRINT("%s on %s\n", __func__, ob->id.name);
+ DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
/* evaluate constraints stack */
// TODO: split this into pre (i.e. BKE_constraints_make_evalob, per-constraint (i.e. inner body of BKE_constraints_solve), post (i.e. BKE_constraints_clear_evalob)
@@ -128,7 +128,7 @@ void BKE_object_eval_constraints(EvaluationContext *UNUSED(eval_ctx),
void BKE_object_eval_done(EvaluationContext *UNUSED(eval_ctx), Object *ob)
{
- PRINT("%s on %s\n", __func__, ob->id.name);
+ DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
/* set negative scale flag in object */
if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
@@ -140,7 +140,7 @@ void BKE_object_eval_modifier(struct EvaluationContext *eval_ctx,
struct Object *ob,
struct ModifierData *md)
{
- PRINT("%s on %s\n", __func__, ob->id.name);
+ DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
(void) eval_ctx; /* Ignored. */
(void) scene; /* Ignored. */
(void) ob; /* Ignored. */
@@ -321,7 +321,7 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
Scene *scene,
Object *ob)
{
- PRINT("%s on %s\n", __func__, ob->id.name);
+ DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
BLI_assert(ob->type != OB_ARMATURE);
BKE_object_handle_data_update(eval_ctx, scene, ob);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 764e6cf..e1c9ae4 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -92,6 +92,7 @@ extern "C" {
#include "depsnode.h"
#include "depsnode_component.h"
+#include "depsgraph_debug.h"
#include "depsnode_operation.h"
#include "depsgraph_types.h"
#include "depsgraph_build.h"
@@ -329,10 +330,10 @@ void DepsgraphRelationBuilder::add_time_relation(TimeSourceDepsNode *timesrc, De
m_graph->add_new_relation(timesrc, node_to, DEPSREL_TYPE_TIME, description);
}
else {
- fprintf(stderr, "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.c_str());
+ deg_debug_printf("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.c_str());
}
}
@@ -343,10 +344,10 @@ void DepsgraphRelationBuilder::add_operation_relation(OperationDepsNode *node_fr
m_graph->add_new_relation(node_from, node_to, type, description);
}
else {
- fprintf(stderr, "add_operation_relation(%p = %s, %p = %s, %d, %s) Failed\n",
- node_from, (node_from) ? node_from->identifier().c_str() : "<None>",
- node_to, (node_to) ? node_to->identifier().c_str() : "<None>",
- type, description.c_str());
+ deg_debug_printf("add_operation_relation(%p = %s, %p = %s, %d, %s) Failed\n",
+ node_from, (node_from) ? node_from->identifier().c_str() : "<None>",
+ node_to, (node_to) ? node_to->identifier().c_str() : "<None>",
+ type, description.c_str());
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 20bc5a1..e53ea7a 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -595,7 +595,9 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
add_relation(driver_key, bone_key, DEPSREL_TYPE_DRIVER, "[Driver -> Bone]");
}
else {
- printf("Couldn't find bone name for driver path - '%s'\n", fcu->rna_path);
+ fprintf(stderr,
+ "Couldn't find bone name for driver path - '%s'\n",
+ fcu->rna_path);
}
}
else if (GS(id->name) == ID_AR && strstr(fcu->rna_path, "bones[")) {
@@ -629,7 +631,9 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
bone_name = NULL;
}
else {
- printf("Couldn't find armature bone name for driver path - '%s'\n", fcu->rna_path);
+ fprintf(stderr,
+ "Couldn't find armature bone name for driver path - '%s'\n",
+ fcu->rna_path);
}
}
else if (GS(id->name) == ID_OB && strstr(fcu->rna_path, "modifiers[")) {
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index 5abeb99..525ba87 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -162,7 +162,7 @@ struct DebugContext {
bool show_eval_priority;
};
-static void deg_debug_printf(const DebugContext &ctx, const char *fmt, ...)
+static void deg_debug_fprintf(const DebugContext &ctx, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -174,10 +174,10 @@ static void deg_debug_graphviz_legend_color(const DebugContext &ctx,
const char *name,
const char *color)
{
- deg_debug_printf(ctx, "<TR>");
- deg_debug_printf(ctx, "<TD>%s</TD>", name);
- deg_debug_printf(ctx, "<TD BGCOLOR=\"%s\"></TD>", color);
- deg_debug_printf(ctx, "</TR>" NL);
+ deg_debug_fprintf(ctx, "<TR>");
+ deg_debug_fprintf(ctx, "<TD>%s</TD>", name);
+ deg_debug_fprintf(ctx, "<TD BGCOLOR=\"%s\"></TD>", color);
+ deg_debug_fprintf(ctx, "</TR>" NL);
}
#if 0
@@ -187,7 +187,7 @@ static void deg_debug_graphviz_legend_line(const DebugContext &ctx,
const char *style)
{
/* XXX TODO */
- deg_debug_printf(ctx, "" NL);
+ deg_debug_fprintf(ctx, "" NL);
}
static void deg_debug_graphviz_legend_cluster(const DebugContext &ctx,
@@ -195,22 +195,22 @@ static void deg_debug_graphviz_legend_cluster(const DebugContext &ctx,
const char *color,
const char *style)
{
- deg_debug_printf(ctx, "<TR>");
- deg_debug_printf(ctx, "<TD>%s</TD>", name);
- deg_debug_printf(ctx, "<TD CELLPADDING=\"4\"><TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">");
- deg_debug_printf(ctx, "<TR><TD BGCOLOR=\"%s\"></TD></TR>", color);
- deg_debug_printf(ctx, "</TABLE></TD>");
- deg_debug_printf(ctx, "</TR>" NL);
+ deg_debug_fprintf(ctx, "<TR>");
+ deg_debug_fprintf(ctx, "<TD>%s</TD>", name);
+ deg_debug_fprintf(ctx, "<TD CELLPADDING=\"4\"><TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">");
+ deg_debug_fprintf(ctx, "<TR><TD BGCOLOR=\"%s\"></TD></TR>", color);
+ deg_debug_fprintf(ctx, "</TABLE></TD>");
+ deg_debug_fprintf(ctx, "</TR>" NL);
}
#endif
static void deg_debug_graphviz_legend(const DebugContext &ctx)
{
- deg_debug_printf(ctx, "{" NL);
- deg_debug_printf(ctx, "rank = sink;" NL);
- deg_debug_printf(ctx, "Legend [shape=none, margin=0, label=<" NL);
- deg_debug_printf(ctx, " <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">" NL);
- deg_debug_printf(ctx, "<TR><TD COLSPAN=\"2\"><B>Legend</B></TD></TR>" NL);
+ deg_debug_fprintf(ctx, "{" NL);
+ deg_debug_fprintf(ctx, "rank = sink;" NL);
+ deg_debug_fprintf(ctx, "Legend [shape=none, margin=0, label=<" NL);
+ deg_debug_fprintf(ctx, " <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">" NL);
+ deg_debug_fprintf(ctx, "<TR><TD COLSPAN=\"2\"><B>Legend</B></TD></TR>" NL);
#ifdef COLOR_SCHEME_NODE_CLASS
const char **colors = deg_debug_colors_light;
@@ -230,11 +230,11 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
}
#endif
- deg_debug_printf(ctx, "</TABLE>" NL);
- deg_debug_printf(ctx, ">" NL);
- deg_debug_printf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname);
- deg_debug_printf(ctx, "];" NL);
- deg_debug_printf(ctx, "}" NL);
+ deg_debug_fprintf(ctx, "</TABLE>" NL);
+ deg_debug_fprintf(ctx, ">" NL);
+ deg_debug_fprintf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname);
+ deg_debug_fprintf(ctx, "];" NL);
+ deg_debug_fprintf(ctx, "}" NL);
}
#if 0 /* unused */
@@ -268,7 +268,7 @@ static void deg_debug_graphviz_node_color(const DebugContext &ctx,
}
}
}
- deg_debug_printf(ctx, "\"%s\"", color);
+ deg_debug_fprintf(ctx, "\"%s\"", color);
}
static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
@@ -289,7 +289,7 @@ static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
}
}
}
- deg_debug_printf(ctx, "\"%f\"",
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list