[Bf-blender-cvs] [a441c44] depsgraph_refactor: Display graph labels in graphviz debug output as an indication of what evaluation step the resulting image represents.
Lukas Tönne
noreply at git.blender.org
Wed Apr 16 10:26:41 CEST 2014
Commit: a441c4421c31f5718566d41740ac8025c9c41e4c
Author: Lukas Tönne
Date: Wed Apr 16 10:07:51 2014 +0200
https://developer.blender.org/rBa441c4421c31f5718566d41740ac8025c9c41e4c
Display graph labels in graphviz debug output as an indication of what
evaluation step the resulting image represents.
===================================================================
M source/blender/depsgraph/DEG_depsgraph_debug.h
M source/blender/depsgraph/intern/depsgraph_debug.cpp
M source/blender/depsgraph/intern/depsgraph_tag.cpp
M source/blender/makesrna/intern/rna_depsgraph.c
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 5eb919c..81c690b 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -40,7 +40,7 @@ extern "C" {
/* ************************************************ */
/* Graphviz Debugging */
-void DEG_debug_graphviz(const struct Depsgraph *graph, FILE *stream, bool show_tags);
+void DEG_debug_graphviz(const struct Depsgraph *graph, FILE *stream, const char *label, bool show_tags);
typedef void (*DEG_DebugBuildCb_NodeAdded)(void *userdata, const struct DepsNode *node);
typedef void (*DEG_DebugBuildCb_RelationAdded)(void *userdata, const struct DepsRelation *rel);
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index 1324cb3..4f36d00 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -61,6 +61,8 @@ extern "C" {
#define NL "\r\n"
static const char *deg_debug_graphviz_fontname = "helvetica";
+static float deg_debug_graphviz_graph_label_size = 20.0f;
+static float deg_debug_graphviz_node_label_size = 14.0f;
static const int deg_debug_max_colors = 12;
static const char *deg_debug_colors_dark[] = {"#6e8997","#144f77","#76945b","#216a1d",
"#a76665","#971112","#a87f49","#a9540",
@@ -301,6 +303,7 @@ static void deg_debug_graphviz_node_single(const DebugContext &ctx, const DepsNo
// deg_debug_printf(ctx, "label=<<B>%s</B>>", name);
deg_debug_printf(ctx, "label=<%s>", name);
deg_debug_printf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname);
+ deg_debug_printf(ctx, ",fontsize=%f", deg_debug_graphviz_node_label_size);
deg_debug_printf(ctx, ",shape=%s", shape);
deg_debug_printf(ctx, ",style="); deg_debug_graphviz_node_style(ctx, node);
deg_debug_printf(ctx, ",color="); deg_debug_graphviz_node_color(ctx, node);
@@ -320,6 +323,7 @@ static void deg_debug_graphviz_node_cluster_begin(const DebugContext &ctx, const
// deg_debug_printf(ctx, "label=<<B>%s</B>>;" NL, name);
deg_debug_printf(ctx, "label=<%s>;" NL, name);
deg_debug_printf(ctx, "fontname=\"%s\";" NL, deg_debug_graphviz_fontname);
+ deg_debug_printf(ctx, "fontsize=%f;" NL, deg_debug_graphviz_node_label_size);
deg_debug_printf(ctx, "style="); deg_debug_graphviz_node_style(ctx, node); deg_debug_printf(ctx, ";" NL);
deg_debug_printf(ctx, "color="); deg_debug_graphviz_node_color(ctx, node); deg_debug_printf(ctx, ";" NL);
deg_debug_printf(ctx, "fillcolor="); deg_debug_graphviz_node_fillcolor(ctx, node); deg_debug_printf(ctx, ";" NL);
@@ -523,7 +527,7 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx, const De
}
}
-void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, bool show_tags)
+void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, const char *label, bool show_tags)
{
#if 0 /* generate shaded color set */
static char colors[][3] = {{0xa6, 0xce, 0xe3},{0x1f, 0x78, 0xb4},{0xb2, 0xdf, 0x8a},{0x33, 0xa0, 0x2c},
@@ -544,7 +548,13 @@ void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, bool show_tags)
deg_debug_printf(ctx, "digraph depgraph {" NL);
deg_debug_printf(ctx, "rankdir=LR;" NL);
- deg_debug_printf(ctx, "graph [compound=true];" NL);
+ deg_debug_printf(ctx, "graph [");
+ deg_debug_printf(ctx, "compound=true");
+ deg_debug_printf(ctx, ",labelloc=\"t\"");
+ deg_debug_printf(ctx, ",fontsize=%f", deg_debug_graphviz_graph_label_size);
+ deg_debug_printf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname);
+ deg_debug_printf(ctx, ",label=\"%s\"", label);
+ deg_debug_printf(ctx, "];" NL);
deg_debug_graphviz_graph_nodes(ctx, graph);
deg_debug_graphviz_graph_relations(ctx, graph);
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cpp b/source/blender/depsgraph/intern/depsgraph_tag.cpp
index 8010a08..07fbef0 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cpp
@@ -130,7 +130,7 @@ void DEG_graph_flush_updates(Depsgraph *graph)
}
if (flushed_subnodes)
- DEG_debug_eval_step("Flush Components");
+ DEG_debug_eval_step(string_format("Flush Components: %s", node->name.c_str()).c_str());
/* flush to nodes along links... */
bool flushed_relations = false;
@@ -147,7 +147,7 @@ void DEG_graph_flush_updates(Depsgraph *graph)
}
if (flushed_relations)
- DEG_debug_eval_step("Flush Dependencies");
+ DEG_debug_eval_step(string_format("Flush Dependencies: %s", node->name.c_str()).c_str());
}
/* clear entry tags, since all tagged nodes should now be reachable from root */
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 584996f..0df040a 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -46,7 +46,7 @@ static void rna_Depsgraph_debug_graphviz(Depsgraph *graph, const char *filename)
if (f == NULL)
return;
- DEG_debug_graphviz(graph, f, false);
+ DEG_debug_graphviz(graph, f, "Depsgraph", false);
fclose(f);
}
@@ -58,7 +58,7 @@ typedef struct DepsgraphEvalDebugInfo {
} DepsgraphEvalDebugInfo;
/* generic debug output function */
-static void rna_Depsgraph_debug_simulate_cb(DepsgraphEvalDebugInfo *info, const char *UNUSED(message))
+static void rna_Depsgraph_debug_simulate_cb(DepsgraphEvalDebugInfo *info, const char *message)
{
char filename[FILE_MAX];
@@ -67,7 +67,7 @@ static void rna_Depsgraph_debug_simulate_cb(DepsgraphEvalDebugInfo *info, const
if (f == NULL)
return;
- DEG_debug_graphviz(info->graph, f, true);
+ DEG_debug_graphviz(info->graph, f, message, true);
fclose(f);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 31da334..77b542a 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1525,13 +1525,15 @@ typedef struct SceneDepsgraphDebugInfo {
static void rna_Scene_depsgraph_debug(SceneDepsgraphDebugInfo *info, void *UNUSED(elem))
{
char filename[FILE_MAX];
+ char label[256];
BLI_snprintf(filename, sizeof(filename), "%s_%04d", info->filename, info->step);
FILE *f = fopen(filename, "w");
if (f == NULL)
return;
- DEG_debug_graphviz(info->graph, f, false);
+ BLI_snprintf(label, sizeof(label), "Build Step #%d", info->step);
+ DEG_debug_graphviz(info->graph, f, label, false);
fclose(f);
More information about the Bf-blender-cvs
mailing list