[Bf-blender-cvs] [26f42a19281] blender2.8: Fix: Toggling "mute" toggle in animation editors didn't work with copy-on-write

Joshua Leung noreply at git.blender.org
Wed May 30 14:22:32 CEST 2018


Commit: 26f42a192819c6c54cc8f07a3e0cc11c14f1b157
Author: Joshua Leung
Date:   Wed May 30 14:20:29 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB26f42a192819c6c54cc8f07a3e0cc11c14f1b157

Fix: Toggling "mute" toggle in animation editors didn't work with copy-on-write

Tested on Autumn run cycle by muting master bone animation - when working, the
dog should run forwards when the master bone animation is being muted.

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

M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/makesrna/intern/rna_fcurve.c

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

diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index e0bb9eebffb..d48798ece97 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -4049,6 +4049,15 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
 	if (ale_setting->type == ANIMTYPE_GPLAYER)
 		WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
 	
+	/* tag copy-on-write flushing (so that the settings will have an effect) */
+	if (ale_setting->id) {
+		DEG_id_tag_update(ale_setting->id, DEG_TAG_COPY_ON_WRITE);
+	}
+	if (ale_setting->adt && ale_setting->adt->action) {
+		/* action is it's own datablock, so has to be tagged specifically... */
+		DEG_id_tag_update(&ale_setting->adt->action->id, DEG_TAG_COPY_ON_WRITE);
+	}
+	
 	/* verify animation context */
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return;
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index d48a0cacd18..681f29dbc91 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -481,6 +481,18 @@ static void rna_FCurve_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
 	rna_FCurve_update_data_ex((FCurve *)ptr->data);
 }
 
+/* RNA update callback for F-Curves to indicate that there are copy-on-write tagging/flushing needed
+ * (e.g. for properties that affect how animation gets evaluated)
+ */
+static void rna_FCurve_update_eval(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+	IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
+	if (iat && iat->adt && iat->adt->action) {
+		/* action is separate datablock, needs separate tag */
+		DEG_id_tag_update(&iat->adt->action->id, DEG_TAG_COPY_ON_WRITE);
+	}
+}
+
 
 static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
 {
@@ -590,10 +602,18 @@ static void rna_FModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
 	ID *id = ptr->id.data;
 	FModifier *fcm = (FModifier *)ptr->data;
 	AnimData *adt = BKE_animdata_from_id(id);
+	
 	DEG_id_tag_update(id, (GS(id->name) == ID_OB) ? OB_RECALC_OB : OB_RECALC_DATA);
+	
 	if (adt != NULL) {
 		adt->recalc |= ADT_RECALC_ANIM;
+		
+		if (adt->action != NULL) {
+			/* action is separate datablock, needs separate tag */
+			DEG_id_tag_update(&adt->action->id, DEG_TAG_COPY_ON_WRITE);
+		}
 	}
+	
 	if (fcm->curve && fcm->type == FMODIFIER_TYPE_CYCLES) {
 		calchandles_fcurve(fcm->curve);
 	}
@@ -1967,7 +1987,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
 	RNA_def_property_ui_text(prop, "Muted", "F-Curve is not evaluated");
-	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval");
 	
 	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_VISIBLE);



More information about the Bf-blender-cvs mailing list