[Bf-blender-cvs] [9521b67ac0d] blender2.8: Depsgraph: Fix missing updates with drivers

Sergey Sharybin noreply at git.blender.org
Wed Mar 14 15:24:10 CET 2018


Commit: 9521b67ac0db5958df14ff92e5334bca07902481
Author: Sergey Sharybin
Date:   Wed Mar 14 15:19:44 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB9521b67ac0db5958df14ff92e5334bca07902481

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.

===================================================================

M	source/blender/blenkernel/intern/anim_sys.c

===================================================================

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,



More information about the Bf-blender-cvs mailing list