Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-10-10 13:25:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-10-11 11:42:45 +0300
commit88ba97558f886c2b58c03d753036c5917a985fdb (patch)
treead76b7c9592251ff0973e381e95bcaee576aebdb /source/blender/makesrna/intern/rna_depsgraph.c
parentc9d6eb4fb42b231037b00d64602ab0c589120cbb (diff)
Depsgraph: Inform when update or tag happens during evaluation
It is not allowed to do tagging or updates while dependency graph is in the middle of evaluation. This is something what is simple to violate from python code. This change adds some sanity checks. The request to update view layer or dependency graph will raise an exception in Python now, so it's easy for scripters to notice. Tagging for update will do silent return unless running with debug command line argument. This is because it's a bit tricky to know which exact dependency graph corresponds to a context from which an update tag was triggered. Differential Revision: https://developer.blender.org/D6035
Diffstat (limited to 'source/blender/makesrna/intern/rna_depsgraph.c')
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c9
1 files changed, 7 insertions, 2 deletions
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). */