[Bf-blender-cvs] [83f8f447913] master: Fix T59495, T59992, T59904, T59178, T60598: broken keyframed value editing.

Brecht Van Lommel noreply at git.blender.org
Thu Jan 31 12:07:21 CET 2019


Commit: 83f8f44791374dd051728e44d89fbdeee15c60aa
Author: Brecht Van Lommel
Date:   Tue Jan 29 11:59:17 2019 +0100
Branches: master
https://developer.blender.org/rB83f8f44791374dd051728e44d89fbdeee15c60aa

Fix T59495, T59992, T59904, T59178, T60598: broken keyframed value editing.

This removes a bunch of animation/driver evaluations and recalc flags that
should be redundant in the new depsgraph, and were incorrectly affecting
the evaluated scene in a permanent way.

Still two cases that could be removed if the depsgraph is improved, in
BKE_object_handle_data_update and BKE_cachefile_update_frame.

For physics subframe interpolation there are also still calls to
BKE_object_where_is_calc that should ideally be removed as well, though
they are not known to cause keyframing bugs.

Differential Revision: https://developer.blender.org/D4274

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

M	source/blender/blenkernel/BKE_animsys.h
M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/blenkernel/intern/cachefile.c
M	source/blender/blenkernel/intern/dynamicpaint.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/depsgraph/intern/builder/deg_builder.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
M	source/blender/draw/engines/eevee/eevee_motion_blur.c
M	source/blender/editors/animation/anim_deps.c
M	source/blender/editors/object/object_constraint.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/physics/physics_fluid.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/makesdna/DNA_anim_types.h
M	source/blender/makesrna/intern/rna_fcurve.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 3790230153a..618d6523b0c 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -186,6 +186,13 @@ void BKE_animsys_free_nla_keyframing_context_cache(struct ListBase *cache);
 /* ------------- Main API -------------------- */
 /* In general, these ones should be called to do all animation evaluation */
 
+/* Flags for recalc parameter, indicating which part to recalculate. */
+typedef enum eAnimData_Recalc {
+	ADT_RECALC_DRIVERS      = (1 << 0),
+	ADT_RECALC_ANIM         = (1 << 1),
+	ADT_RECALC_ALL          = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM),
+} eAnimData_Recalc;
+
 /* Evaluation loop for evaluating animation data  */
 void BKE_animsys_evaluate_animdata(struct Depsgraph *depsgraph, struct Scene *scene, struct ID *id, struct AnimData *adt, float ctime, short recalc);
 
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index c7d34480a20..7117d8942f4 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -166,9 +166,6 @@ void BKE_object_where_is_calc_ex(
         struct Object *ob, float r_originmat[3][3]);
 void BKE_object_where_is_calc_time(
         struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime);
-void BKE_object_where_is_calc_time_ex(
-        struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime,
-        struct RigidBodyWorld *rbw, float r_originmat[3][3]);
 void BKE_object_where_is_calc_mat4(struct Object *ob, float obmat[4][4]);
 
 /* possibly belong in own moduke? */
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 10ceee487fb..13bcfaf4f32 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1470,7 +1470,6 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
 		/* init animdata, and attach to workob */
 		workob->adt = &adt;
 
-		adt.recalc = ADT_RECALC_ANIM;
 		adt.action = act;
 
 		/* execute effects of Action on to workob (or it's PoseChannels) */
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 9aff54ea3bc..5be89212004 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1764,7 +1764,7 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
 		if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
 			/* check if driver itself is tagged for recalculation */
 			/* XXX driver recalc flag is not set yet by depsgraph! */
-			if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID) /*&& (driver->flag & DRIVER_FLAG_RECALC)*/) {
+			if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID)) {
 				/* evaluate this using values set already in other places
 				 * NOTE: for 'layering' option later on, we should check if we should remove old value before adding
 				 *       new to only be done when drivers only changed */
@@ -1775,9 +1775,6 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
 					ok = animsys_write_rna_setting(&anim_rna, curval);
 				}
 
-				/* clear recalc flag */
-				driver->flag &= ~DRIVER_FLAG_RECALC;
-
 				/* set error-flag if evaluation failed */
 				if (ok == 0)
 					driver->flag |= DRIVER_FLAG_INVALID;
@@ -3513,7 +3510,7 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
 	 *   that overrides 'rough' work in NLA
 	 */
 	/* TODO: need to double check that this all works correctly */
-	if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) {
+	if (recalc & ADT_RECALC_ANIM) {
 		/* evaluate NLA data */
 		if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) {
 			/* evaluate NLA-stack
@@ -3524,9 +3521,6 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
 		/* evaluate Active Action only */
 		else if (adt->action)
 			animsys_evaluate_action_ex(depsgraph, &id_ptr, adt->action, ctime);
-
-		/* reset tag */
-		adt->recalc &= ~ADT_RECALC_ANIM;
 	}
 
 	/* recalculate drivers
@@ -3534,10 +3528,7 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
 	 *   or be layered on top of existing animation data.
 	 * - Drivers should be in the appropriate order to be evaluated without problems...
 	 */
-	if ((recalc & ADT_RECALC_DRIVERS)
-	    /* XXX for now, don't check yet, as depsgraph hasn't been updated */
-	    /* && (adt->recalc & ADT_RECALC_DRIVERS)*/)
-	{
+	if (recalc & ADT_RECALC_DRIVERS) {
 		animsys_evaluate_drivers(&id_ptr, adt, ctime);
 	}
 
@@ -3555,9 +3546,6 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
 		RNA_property_update_cache_flush(bmain, scene);
 		RNA_property_update_cache_free();
 	}
-
-	/* clear recalc flag now */
-	adt->recalc = 0;
 }
 
 /* Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only
@@ -3705,8 +3693,7 @@ void BKE_animsys_eval_animdata(Depsgraph *depsgraph, ID *id)
 	                      * which should get handled as part of the dependency graph instead...
 	                      */
 	DEG_debug_print_eval_time(depsgraph, __func__, id->name, id, ctime);
-	short recalc = ADT_RECALC_ANIM;
-	BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, recalc);
+	BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, ADT_RECALC_ANIM);
 }
 
 void BKE_animsys_update_driver_array(ID *id)
@@ -3758,7 +3745,7 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
 	if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
 		/* check if driver itself is tagged for recalculation */
 		/* XXX driver recalc flag is not set yet by depsgraph! */
-		if ((driver_orig) && !(driver_orig->flag & DRIVER_FLAG_INVALID) /*&& (driver_orig->flag & DRIVER_FLAG_RECALC)*/) {
+		if ((driver_orig) && !(driver_orig->flag & DRIVER_FLAG_INVALID)) {
 			/* evaluate this using values set already in other places
 			 * NOTE: for 'layering' option later on, we should check if we should remove old value before adding
 			 *       new to only be done when drivers only changed */
@@ -3797,11 +3784,6 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
 				}
 			}
 
-			//printf("\tnew val = %f\n", fcu->curval);
-
-			/* clear recalc flag */
-			driver_orig->flag &= ~DRIVER_FLAG_RECALC;
-
 			/* set error-flag if evaluation failed */
 			if (ok == 0) {
 				printf("invalid driver - %s[%d]\n", fcu->rna_path, fcu->array_index);
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c
index 6fcfe468e98..128608b3b51 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -184,7 +184,8 @@ void BKE_cachefile_update_frame(
 	char filename[FILE_MAX];
 
 	for (cache_file = bmain->cachefiles.first; cache_file; cache_file = cache_file->id.next) {
-		/* Execute drivers only, as animation has already been done. */
+		/* TODO: dependency graph should be updated to do drivers on cachefile.
+		 * Execute drivers only, as animation has already been done. */
 		BKE_animsys_evaluate_animdata(depsgraph, scene, &cache_file->id, cache_file->adt, ctime, ADT_RECALC_DRIVERS);
 
 		if (!cache_file->is_sequence) {
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 2cb9bd5c619..74f8f27b601 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -5962,8 +5962,6 @@ static int dynamicPaint_doStep(
 					    psys_check_enabled(brushObj, brush->psys, for_render))
 					{
 						/* Paint a particle system */
-						BKE_animsys_evaluate_animdata(depsgraph, scene, &brush->psys->part->id, brush->psys->part->adt,
-						                              BKE_scene_frame_get(scene), ADT_RECALC_ANIM);
 						dynamicPaint_paintParticles(surface, brush->psys, brush, timescale);
 					}
 					/* Object center distance: */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 341a15268ef..f3ff601b7e0 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2210,15 +2210,10 @@ static void solve_parenting(Object *ob, Object *par, float obmat[4][4],
 }
 
 /* note, scene is the active scene while actual_scene is the scene the object resides in */
-void BKE_object_where_is_calc_time_ex(
+static void object_where_is_calc_ex(
         Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime,
         RigidBodyWorld *rbw, float r_originmat[3][3])
 {
-	if (ob == NULL) return;
-
-	/* execute drivers only, as animation has already been done */
-	BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
-
 	if (ob->parent) {
 		Object *par = ob->parent;
 
@@ -2249,7 +2244,9 @@ void BKE_object_where_is_calc_time_ex(
 
 void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
 {
-	BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, NULL, NULL);
+	/* Execute drivers and animation. */
+	BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
+	object_where_is_calc_ex(depsgraph, scene, ob, ctime, NULL, NULL);
 }
 
 /* get object transformation matrix without recalculating dependencies and
@@ -2269,11 +2266,13 @@ void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
 
 void BKE_object_where_is_calc_ex(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
 {
-	BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), rbw, r_originmat);
+	float ctime = DEG_get_ctime(depsgraph);
+	object_where_is_calc_ex(depsgraph, scene, ob, ctime, rbw, r_originmat);
 }
 void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
-	BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), NULL, NULL);
+	float ctime = DEG_get_ctime(depsgraph);
+	object_whe

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list