diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-25 13:06:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-25 13:06:56 +0300 |
commit | 3fe534eebbcbbdf6551f18a24081dfb9fd314208 (patch) | |
tree | 07c24a4dd9b7756ad2dce8461338315fd17bf534 /source/blender/makesrna/intern/rna_depsgraph.c | |
parent | 6ec8344243e6935281120a504b5a3355d2b3620a (diff) |
Depsgraph: Make depsgraph.debug_stats to return a string
This way we can see result in the python console.
Diffstat (limited to 'source/blender/makesrna/intern/rna_depsgraph.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_depsgraph.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index 2748bd8b877..3a0aa506765 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -38,6 +38,8 @@ #include "BKE_depsgraph.h" +#define STATS_MAX_SIZE 16384 + #ifdef RNA_RUNTIME #include "BKE_report.h" @@ -65,17 +67,12 @@ static void rna_Depsgraph_debug_rebuild(Depsgraph *UNUSED(graph), Main *bmain) } } -static void rna_Depsgraph_debug_stats(Depsgraph *graph, ReportList *reports) +static void rna_Depsgraph_debug_stats(Depsgraph *graph, char *result) { size_t outer, ops, rels; - DEG_stats_simple(graph, &outer, &ops, &rels); - - // XXX: report doesn't seem to work - printf("Approx %lu Operations, %lu Relations, %lu Outer Nodes\n", - ops, rels, outer); - - BKE_reportf(reports, RPT_WARNING, "Approx. %lu Operations, %lu Relations, %lu Outer Nodes", + BLI_snprintf(result, STATS_MAX_SIZE, + "Approx %lu Operations, %lu Relations, %lu Outer Nodes", ops, rels, outer); } @@ -100,7 +97,10 @@ static void rna_def_depsgraph(BlenderRNA *brna) func = RNA_def_function(srna, "debug_stats", "rna_Depsgraph_debug_stats"); RNA_def_function_ui_description(func, "Report the number of elements in the Dependency Graph"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); + /* weak!, no way to return dynamic string type */ + parm = RNA_def_string(func, "result", NULL, STATS_MAX_SIZE, "result", ""); + RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */ + RNA_def_function_output(func, parm); } void RNA_def_depsgraph(BlenderRNA *brna) |