diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-01-19 12:44:34 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2020-01-24 20:48:02 +0300 |
commit | fc1f5bded46afbb9b16fffe9e4c7f7c212566255 (patch) | |
tree | e4beb4c3119d87a668709b67e586ca8a1d9f0804 /source/blender/depsgraph | |
parent | 300f937aec5d0be7b6003a5e835cd2a33bd52d64 (diff) |
Depsgraph: fix false positive time dependencies for simple drivers.
The dependency graph has to know whether a driver must be re-evaluated
every frame due to a dependency on the current frame number. For python
drivers it was using a heuristic based on searching for certain sub-
strings in the expression, notably including '('.
When the expression is actually evaluated using Python, this can't be
easily improved; however if the Simple Expression evaluator is used,
this check can be done precisely by accessing the parsed data.
Differential Revision: https://developer.blender.org/D6624
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 7d7a183ee75..fa7a63227f5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -123,28 +123,6 @@ namespace DEG { namespace { -/* TODO(sergey): This is somewhat weak, but we don't want neither false-positive - * time dependencies nor special exceptions in the depsgraph evaluation. */ - -bool python_driver_exression_depends_on_time(const char *expression) -{ - if (expression[0] == '\0') { - /* Empty expression depends on nothing. */ - return false; - } - if (strchr(expression, '(') != NULL) { - /* Function calls are considered dependent on a time. */ - return true; - } - if (strstr(expression, "frame") != NULL) { - /* Variable `frame` depends on time. */ - /* TODO(sergey): This is a bit weak, but not sure about better way of handling this. */ - return true; - } - /* Possible indirect time relation s should be handled via variable targets. */ - return false; -} - bool driver_target_depends_on_time(const DriverTarget *target) { if (target->idtype == ID_SCE && @@ -176,10 +154,8 @@ bool driver_variables_depends_on_time(const ListBase *variables) bool driver_depends_on_time(ChannelDriver *driver) { - if (driver->type == DRIVER_TYPE_PYTHON) { - if (python_driver_exression_depends_on_time(driver->expression)) { - return true; - } + if (BKE_driver_expression_depends_on_time(driver)) { + return true; } if (driver_variables_depends_on_time(&driver->variables)) { return true; |