diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-25 13:17:45 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-25 13:21:08 +0300 |
commit | 220fbddc8b64ac367f88fcf61b805de6626d717a (patch) | |
tree | 52cb5af2d9f26dcd7b5aee8470fcda6844a480e6 /source | |
parent | d8da33d21c2fa6035e7dafbea66880d3f3c84cea (diff) | |
parent | ea5cf3ff7ae9a20fda9d26159a8ada6c2970aa48 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_depsgraph.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index bab718c7235..f5b4d9cde0f 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -38,10 +38,11 @@ #include "DNA_object_types.h" +#define STATS_MAX_SIZE 16384 + #ifdef RNA_RUNTIME #include "BLI_iterator.h" -#include "BKE_report.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_debug.h" @@ -122,41 +123,25 @@ static int rna_DepsgraphIter_is_instance_get(PointerRNA *ptr) static void rna_Depsgraph_debug_graphviz(Depsgraph *graph, const char *filename) { FILE *f = fopen(filename, "w"); - if (f == NULL) + if (f == NULL) { return; - + } DEG_debug_graphviz(graph, f, "Depsgraph", false); - fclose(f); } -static void rna_Depsgraph_debug_rebuild(Depsgraph *UNUSED(graph), bContext *C) +static void rna_Depsgraph_debug_tag_update(Depsgraph *graph) { - Main *bmain = CTX_data_main(C); - EvaluationContext eval_ctx; - Scene *sce; - - CTX_data_eval_ctx(C, &eval_ctx); - - DEG_relations_tag_update(bmain); - for (sce = bmain->scene.first; sce; sce = sce->id.next) { - DEG_scene_relations_rebuild(bmain, sce); - DEG_graph_on_visible_update(bmain, sce->depsgraph_legacy); - } + DEG_graph_tag_relations_update(graph); } -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", - ops, rels, outer); + BLI_snprintf(result, STATS_MAX_SIZE, + "Approx %lu Operations, %lu Relations, %lu Outer Nodes", + ops, rels, outer); } /* Iteration over objects, simple version */ @@ -310,12 +295,14 @@ static void rna_def_depsgraph(BlenderRNA *brna) "File in which to store graphviz debug output"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - func = RNA_def_function(srna, "debug_rebuild", "rna_Depsgraph_debug_rebuild"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func = RNA_def_function(srna, "debug_tag_update", "rna_Depsgraph_debug_tag_update"); 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); prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); |