Fix #116220: Context property driver does not update during playback

This commit fixes missing updates during playback when `frame_current`
property of the active scene is used.

Applied the same check for the depends-on-time as for explicitly
specified scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/116886
This commit is contained in:
Sergey Sharybin
2024-01-08 12:30:33 +01:00
committed by Sergey Sharybin
parent 4d56b696ec
commit fed446ce8a

View File

@@ -119,20 +119,30 @@ namespace blender::deg {
namespace {
bool driver_target_depends_on_time(const DriverTarget *target)
bool is_time_dependent_scene_driver_target(const DriverTarget *target)
{
if (target->idtype == ID_SCE &&
(target->rna_path != nullptr && STREQ(target->rna_path, "frame_current")))
return target->rna_path != nullptr && STREQ(target->rna_path, "frame_current");
}
bool driver_target_depends_on_time(const DriverVar *variable, const DriverTarget *target)
{
if (variable->type == DVAR_TYPE_CONTEXT_PROP &&
target->context_property == DTAR_CONTEXT_PROPERTY_ACTIVE_SCENE)
{
return true;
return is_time_dependent_scene_driver_target(target);
}
if (target->idtype == ID_SCE) {
return is_time_dependent_scene_driver_target(target);
}
return false;
}
bool driver_variable_depends_on_time(const DriverVar *variable)
{
for (int i = 0; i < variable->num_targets; ++i) {
if (driver_target_depends_on_time(&variable->targets[i])) {
if (driver_target_depends_on_time(variable, &variable->targets[i])) {
return true;
}
}