diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-14 17:19:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-14 17:21:31 +0300 |
commit | 9521b67ac0db5958df14ff92e5334bca07902481 (patch) | |
tree | e77f3bfc52507ecb8d17b02a8d8725ed642d6040 /source/blender/blenkernel/intern | |
parent | 5c30121b8ca0d46f8aaf9ae7e33383b2c45c7c78 (diff) |
Depsgraph: Fix missing updates with drivers
The issue was only visible with copy-on-write enabled, and related to the
fact, that dependency graph builder binds original FCurves.
For now use smallest patch possible to make things to work and to make
draguu happy.
Need to think of a smarter way to deal with drivers, bones and view layers.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index b79a8d5cbed..d1b26d9a2a0 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2891,6 +2891,24 @@ void BKE_animsys_eval_animdata(const EvaluationContext *eval_ctx, ID *id) BKE_animsys_evaluate_animdata(scene, id, adt, eval_ctx->ctime, ADT_RECALC_ANIM); } +/* TODO(sergey): This is slow lookup of driver from CoW datablock. + * Keep this for until we've got something smarter for depsgraph + * building.\ + */ +static FCurve *find_driver_from_evaluated_id(ID *id, FCurve *fcu) +{ + /* We've got non-CoW datablock, can use f-curve as-is. */ + if (id->orig_id == NULL) { + return fcu; + } + /*const*/ ID *id_orig = id->orig_id; + const AnimData *adt_orig = BKE_animdata_from_id(id_orig); + const AnimData *adt_cow = BKE_animdata_from_id(id); + const int fcu_index = BLI_findindex(&adt_orig->drivers, fcu); + BLI_assert(fcu_index != -1); + return BLI_findlink(&adt_cow->drivers, fcu_index); +} + void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, ID *id, FCurve *fcu) @@ -2900,6 +2918,8 @@ void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, PointerRNA id_ptr; bool ok = false; + fcu = find_driver_from_evaluated_id(id, fcu); + DEBUG_PRINT("%s on %s (%s[%d])\n", __func__, id->name, |