[Bf-blender-cvs] [0dea135a36e] blender2.8: NLA: fix frame mapping applied twice keyframing from graph/action editors.

Alexander Gavrilov noreply at git.blender.org
Sun Nov 11 10:42:57 CET 2018


Commit: 0dea135a36e5f9d06c60270f0bcca64a20a2cbd6
Author: Alexander Gavrilov
Date:   Wed Nov 7 18:05:22 2018 +0300
Branches: blender2.8
https://developer.blender.org/rB0dea135a36e5f9d06c60270f0bcca64a20a2cbd6

NLA: fix frame mapping applied twice keyframing from graph/action editors.

The insert_keyframe function already applies NLA strip to action
time remapping, so doing it in insert_graph_keys/insert_action_keys
is redundant outside the code path that inserts directly into fcurve.

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

M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_graph/graph_edit.c

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

diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 4cec73f306b..377698d931c 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -700,15 +700,8 @@ static void insert_action_keys(bAnimContext *ac, short mode)
 
 	/* insert keyframes */
 	for (ale = anim_data.first; ale; ale = ale->next) {
-		AnimData *adt = ANIM_nla_mapping_get(ac, ale);
 		FCurve *fcu = (FCurve *)ale->key_data;
-		float cfra;
-
-		/* adjust current frame for NLA-scaling */
-		if (adt)
-			cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
-		else
-			cfra = (float)CFRA;
+		float cfra = (float)CFRA;
 
 		/* read value from property the F-Curve represents, or from the curve only?
 		 * - ale->id != NULL:    Typically, this means that we have enough info to try resolving the path
@@ -721,6 +714,12 @@ static void insert_action_keys(bAnimContext *ac, short mode)
 			                fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag);
 		}
 		else {
+			AnimData *adt = ANIM_nla_mapping_get(ac, ale);
+
+			/* adjust current frame for NLA-scaling */
+			if (adt)
+				cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+
 			const float curval = evaluate_fcurve(fcu, cfra);
 			insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
 		}
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index b10141929d5..4a5bd0c09b9 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -589,17 +589,8 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
 	}
 	else {
 		for (ale = anim_data.first; ale; ale = ale->next) {
-			AnimData *adt = ANIM_nla_mapping_get(ac, ale);
 			FCurve *fcu = (FCurve *)ale->key_data;
-			float cfra;
-
-			/* adjust current frame for NLA-mapping */
-			if ((sipo) && (sipo->mode == SIPO_MODE_DRIVERS))
-				cfra = sipo->cursorTime;
-			else if (adt)
-				cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
-			else
-				cfra = (float)CFRA;
+			float cfra = (float)CFRA;
 
 			/* read value from property the F-Curve represents, or from the curve only?
 			 * - ale->id != NULL:    Typically, this means that we have enough info to try resolving the path
@@ -614,6 +605,14 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
 				                fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag);
 			}
 			else {
+				AnimData *adt = ANIM_nla_mapping_get(ac, ale);
+
+				/* adjust current frame for NLA-mapping */
+				if ((sipo) && (sipo->mode == SIPO_MODE_DRIVERS))
+					cfra = sipo->cursorTime;
+				else if (adt)
+					cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+
 				const float curval = evaluate_fcurve(fcu, cfra);
 				insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
 			}



More information about the Bf-blender-cvs mailing list