diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-10 13:25:23 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-11 11:42:45 +0300 |
commit | 88ba97558f886c2b58c03d753036c5917a985fdb (patch) | |
tree | ad76b7c9592251ff0973e381e95bcaee576aebdb /source/blender/depsgraph/intern | |
parent | c9d6eb4fb42b231037b00d64602ab0c589120cbb (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/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 6 |
1 files changed, 6 insertions, 0 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__, |