[Bf-blender-cvs] [5793293] master: Fix T45166: Keyframes pasted at wrong position when NLA strip has offset

Joshua Leung noreply at git.blender.org
Thu Aug 6 16:48:47 CEST 2015


Commit: 579329388af58b44f545c2e4411bbd987256b923
Author: Joshua Leung
Date:   Fri Aug 7 02:23:55 2015 +1200
Branches: master
https://developer.blender.org/rB579329388af58b44f545c2e4411bbd987256b923

Fix T45166: Keyframes pasted at wrong position when NLA strip has offset

Paste keyframes code seemed to have overlooked the NLA mapping issue, causing
keyframes to get pasted in the wrong places.

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

M	source/blender/editors/animation/keyframes_general.c

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

diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index cb49c2f..3642c07 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -869,7 +869,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
 		 */
 		
 		insert_bezt_fcurve(fcu, bezt, INSERTKEY_OVERWRITE_FULL);
-
+		
 		/* un-apply offset from src beztriple after copying */
 		bezt->vec[0][0] -= offset;
 		bezt->vec[1][0] -= offset;
@@ -971,6 +971,7 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
 				 *	- if names do matter, only check if id-type is ok for now (group check is not that important)
 				 *	- most importantly, rna-paths should match (array indices are unimportant for now)
 				 */
+				AnimData *adt = ANIM_nla_mapping_get(ac, ale);
 				FCurve *fcu = (FCurve *)ale->data;  /* destination F-Curve */
 				tAnimCopybufItem *aci = NULL;
 				
@@ -994,9 +995,17 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
 				/* copy the relevant data from the matching buffer curve */
 				if (aci) {
 					totmatch++;
-					paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip);
+					
+					if (adt) {
+						ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
+						paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip);
+						ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
+					}
+					else {
+						paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip);
+					}
 				}
-
+				
 				ale->update |= ANIM_UPDATE_DEFAULT;
 			}




More information about the Bf-blender-cvs mailing list