[Bf-blender-cvs] [b9b4454] depsgraph_refactor: RNA function for debug output of depsgraph evaluation (stub for now).
Lukas Tönne
noreply at git.blender.org
Mon Apr 14 13:52:17 CEST 2014
Commit: b9b4454195fa10b45d9c0e4c9feb193f57444ee1
Author: Lukas Tönne
Date: Sun Apr 13 16:35:03 2014 +0200
https://developer.blender.org/rBb9b4454195fa10b45d9c0e4c9feb193f57444ee1
RNA function for debug output of depsgraph evaluation (stub for now).
===================================================================
M source/blender/depsgraph/DEG_depsgraph_debug.h
M source/blender/depsgraph/intern/depsgraph_debug.cpp
M source/blender/makesrna/intern/rna_depsgraph.c
===================================================================
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 2863167..c817fbb 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -48,6 +48,11 @@ typedef void (*DEG_DebugBuildCb_RelationAdded)(void *userdata, const struct Deps
void DEG_debug_build_init(void *userdata, DEG_DebugBuildCb_NodeAdded node_added_cb, DEG_DebugBuildCb_RelationAdded rel_added_cb);
void DEG_debug_build_end(void);
+typedef void (*DEG_DebugEvalCb)(void *userdata, const char *message);
+
+void DEG_debug_eval_init(void *userdata, DEG_DebugEvalCb cb);
+void DEG_debug_eval_end(void);
+
/* ************************************************ */
#ifdef __cplusplus
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index d92b765..3f6c271 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -490,8 +490,10 @@ void DEG_debug_graphviz(const Depsgraph *graph, FILE *f)
#ifdef DEG_DEBUG_BUILD
static void *deg_debug_build_userdata;
+static void *deg_debug_eval_userdata;
DEG_DebugBuildCb_NodeAdded deg_debug_build_node_added_cb;
DEG_DebugBuildCb_RelationAdded deg_debug_build_rel_added_cb;
+DEG_DebugEvalCb deg_debug_eval_cb;
void DEG_debug_build_init(void *userdata, DEG_DebugBuildCb_NodeAdded node_added_cb, DEG_DebugBuildCb_RelationAdded rel_added_cb)
{
@@ -521,6 +523,18 @@ void DEG_debug_build_end(void)
deg_debug_build_rel_added_cb = NULL;
}
+void DEG_debug_eval_init(void *userdata, DEG_DebugEvalCb cb)
+{
+ deg_debug_eval_userdata = userdata;
+ deg_debug_eval_cb = cb;
+}
+
+void DEG_debug_eval_end(void)
+{
+ deg_debug_eval_userdata = NULL;
+ deg_debug_eval_cb = NULL;
+}
+
#else /* DEG_DEBUG_BUILD */
void DEG_debug_build_init(void *userdata, DEG_DebugBuildCb_NodeAdded node_added_cb, DEG_DebugBuildCb_RelationAdded rel_added_cb) {}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 77f61e4..41c2823 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -51,12 +51,57 @@ static void rna_Depsgraph_debug_graphviz(Depsgraph *graph, const char *filename)
fclose(f);
}
+typedef struct DepsgraphEvalDebugInfo {
+ const char *filename;
+ int step;
+ const Depsgraph *graph;
+} DepsgraphEvalDebugInfo;
+
+/* generic debug output function */
+static void rna_Depsgraph_debug_simulate_cb(DepsgraphEvalDebugInfo *info, const char *UNUSED(message))
+{
+ char filename[FILE_MAX];
+
+ BLI_snprintf(filename, sizeof(filename), "%s_eval_%04d", info->filename, info->step);
+ FILE *f = fopen(filename, "w");
+ if (f == NULL)
+ return;
+
+ DEG_debug_graphviz(info->graph, f);
+
+ fclose(f);
+
+ ++info->step;
+}
+
+static void rna_Depsgraph_debug_simulate(Depsgraph *graph, const char *filename)
+{
+ FILE *f = fopen(filename, "w");
+ if (f == NULL)
+ return;
+
+
+ DEG_debug_graphviz(graph, f);
+
+ fclose(f);
+ DepsgraphEvalDebugInfo debug_info;
+ debug_info.filename = filename;
+ debug_info.step = 0;
+ debug_info.graph = graph;
+
+ DEG_debug_eval_init(&debug_info,
+ (DEG_DebugEvalCb)rna_Depsgraph_debug_simulate_cb);
+
+ /* ... TODO */
+
+ DEG_debug_eval_end();
+}
+
#else
static void rna_def_depsgraph(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
FunctionRNA *func;
PropertyRNA *parm;
@@ -67,6 +112,11 @@ static void rna_def_depsgraph(BlenderRNA *brna)
parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
"File in which to store graphviz debug output");
RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func = RNA_def_function(srna, "debug_simulate", "rna_Depsgraph_debug_simulate");
+ parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
+ "File in which to store graphviz debug output");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
}
void RNA_def_depsgraph(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list