diff options
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_depsgraph.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 17 |
3 files changed, 26 insertions, 6 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index b67629cde9e..7f025097843 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -622,6 +622,12 @@ void graph_id_tag_update( Main *bmain, Depsgraph *graph, ID *id, int flag, eUpdateSource update_source) { const int debug_flags = (graph != NULL) ? DEG_debug_flags_get((::Depsgraph *)graph) : G.debug; + if (graph != NULL && graph->is_evaluating) { + if (debug_flags & G_DEBUG_DEPSGRAPH) { + printf("ID tagged for update during dependency graph evaluation."); + } + return; + } if (debug_flags & G_DEBUG_DEPSGRAPH_TAG) { printf("%s: id=%s flags=%s source=%s\n", __func__, diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index ebd9bd8e925..2072b07ecb3 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -261,8 +261,13 @@ static void rna_Depsgraph_debug_stats(Depsgraph *depsgraph, char *result) outer); } -static void rna_Depsgraph_update(Depsgraph *depsgraph, Main *bmain) +static void rna_Depsgraph_update(Depsgraph *depsgraph, Main *bmain, ReportList *reports) { + if (DEG_is_evaluating(depsgraph)) { + BKE_report(reports, RPT_ERROR, "Dependency graph update requested during evaluation"); + return; + } + # ifdef WITH_PYTHON /* Allow drivers to be evaluated */ BPy_BEGIN_ALLOW_THREADS; @@ -654,7 +659,7 @@ static void rna_def_depsgraph(BlenderRNA *brna) func, "Re-evaluate any modified data-blocks, for example for animation or modifiers. " "This invalidates all references to evaluated data-blocks from this dependency graph."); - RNA_def_function_flag(func, FUNC_USE_MAIN); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); /* Queries for original datablockls (the ones depsgraph is built for). */ diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 12d89ef5deb..40c6229f9b1 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -187,15 +187,24 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip); } -static void rna_ViewLayer_update_tagged(ID *id_ptr, ViewLayer *view_layer, Main *bmain) +static void rna_ViewLayer_update_tagged(ID *id_ptr, + ViewLayer *view_layer, + Main *bmain, + ReportList *reports) { + Scene *scene = (Scene *)id_ptr; + Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); + + if (DEG_is_evaluating(depsgraph)) { + BKE_report(reports, RPT_ERROR, "Dependency graph update requested during evaluation"); + return; + } + # ifdef WITH_PYTHON /* Allow drivers to be evaluated */ BPy_BEGIN_ALLOW_THREADS; # endif - Scene *scene = (Scene *)id_ptr; - Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); /* NOTE: This is similar to CTX_data_depsgraph_pointer(). Ideally such access would be * de-duplicated across all possible cases, but for now this is safest and easiest way to go. * @@ -568,7 +577,7 @@ void RNA_def_view_layer(BlenderRNA *brna) /* debug update routine */ func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); RNA_def_function_ui_description( func, "Update data tagged to be updated from previous access to data or operators"); |