[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26019] trunk/blender/source/blender/ editors: Reverting changes made in r25940 with the NLA unmapping.

Joshua Leung aligorith at gmail.com
Fri Jan 15 11:34:40 CET 2010


Revision: 26019
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26019
Author:   aligorith
Date:     2010-01-15 11:34:39 +0100 (Fri, 15 Jan 2010)

Log Message:
-----------
Reverting changes made in r25940 with the NLA unmapping. 

The reverted code was just blindly restoring the old state of the keyframes; changes to selection state, value changes, handle type, etc. were overridden, and the cases where keyframes were deliberately retimed or otherwise were also ignored.  

I'm not sure what problems these changes were meant to be solving, but will reassess the situation when I get more info on this.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_draw.c
    trunk/blender/source/blender/editors/animation/keyframes_draw.c
    trunk/blender/source/blender/editors/include/ED_anim_api.h
    trunk/blender/source/blender/editors/include/ED_keyframes_edit.h
    trunk/blender/source/blender/editors/space_action/action_edit.c
    trunk/blender/source/blender/editors/space_action/action_select.c
    trunk/blender/source/blender/editors/space_graph/graph_draw.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_select.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c

Modified: trunk/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_draw.c	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/animation/anim_draw.c	2010-01-15 10:34:39 UTC (rev 26019)
@@ -260,15 +260,18 @@
 /* helper function for ANIM_nla_mapping_apply_fcurve() -> "restore", i.e. mapping points back to action-time */
 static short bezt_nlamapping_restore(BeztEditData *bed, BezTriple *bezt)
 {
-	ListBase *lb= (ListBase*)bed->data2;
-	NlaMappingApplyBackup *backup= lb->first;
-
-	/* restore beztriple from backup list. this used to use NLATIME_CONVERT_UNMAP,
-	   but this was not the inverse of NLATIME_CONVERT_MAP and it's not clear how
-	   that is even possible due to repeats - brecht. */
-	*bezt= backup->bezt;
-	BLI_freelinkN(lb, backup);
+	/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
+	AnimData *adt= (AnimData *)bed->data;
+	short only_keys= (short)bed->i1;
 	
+	/* adjust BezTriple handles only if allowed to */
+	if (only_keys == 0) {
+		bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_UNMAP);
+		bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_UNMAP);
+	}
+	
+	bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_UNMAP);
+	
 	return 0;
 }
 
@@ -277,14 +280,7 @@
 {
 	/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
 	AnimData *adt= (AnimData*)bed->data;
-	ListBase *lb= (ListBase*)bed->data2;
-	NlaMappingApplyBackup *backup;
 	short only_keys= (short)bed->i1;
-
-	/* backup for restore later */
-	backup= MEM_callocN(sizeof(NlaMappingApplyBackup), "NlaMappingApplyBackup");
-	backup->bezt= *bezt;
-	BLI_addtail(lb, backup);
 	
 	/* adjust BezTriple handles only if allowed to */
 	if (only_keys == 0) {
@@ -302,7 +298,7 @@
  *	- restore = whether to map points back to non-mapped time 
  * 	- only_keys = whether to only adjust the location of the center point of beztriples
  */
-void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys, ListBase *backup)
+void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys)
 {
 	BeztEditData bed;
 	BeztEditFunc map_cb;
@@ -313,11 +309,7 @@
 	 */
 	memset(&bed, 0, sizeof(BeztEditData));
 	bed.data= (void *)adt;
-	bed.data2= (void *)backup;
 	bed.i1= (int)only_keys;
-
-	if(!restore)
-		backup->first= backup->last= NULL;
 	
 	/* get editing callback */
 	if (restore)

Modified: trunk/blender/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_draw.c	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/animation/keyframes_draw.c	2010-01-15 10:34:39 UTC (rev 26019)
@@ -850,13 +850,12 @@
 {
 	DLRBT_Tree *beztTree = NULL;
 	BezTriple *bezt;
-	ListBase nlabackup;
 	int v;
 	
 	if (fcu && fcu->totvert && fcu->bezt) {
 		/* apply NLA-mapping (if applicable) */
 		if (adt)	
-			ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1);
 		
 		/* if getting long keyframes too, grab the BezTriples in a BST for 
 		 * accelerated searching...
@@ -893,7 +892,7 @@
 		
 		/* unapply NLA-mapping if applicable */
 		if (adt)
-			ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1);
 	}
 }
 

Modified: trunk/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_anim_api.h	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/include/ED_anim_api.h	2010-01-15 10:34:39 UTC (rev 26019)
@@ -453,7 +453,7 @@
 struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale);
 
 /* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */
-void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys, ListBase *backup);
+void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys);
 
 /* ..... */
 

Modified: trunk/blender/source/blender/editors/include/ED_keyframes_edit.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_keyframes_edit.h	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/include/ED_keyframes_edit.h	2010-01-15 10:34:39 UTC (rev 26019)
@@ -94,7 +94,6 @@
 	ListBase list;				/* temp list for storing custom list of data to check */
 	struct Scene *scene;		/* pointer to current scene - many tools need access to cfra/etc.  */
 	void *data;					/* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
-	void *data2;				/* pointer to more custom data */
 	float f1, f2;				/* storage of times/values as 'decimals' */
 	int i1, i2;					/* storage of times/values/flags as 'whole' numbers */
 } BeztEditData;

Modified: trunk/blender/source/blender/editors/space_action/action_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_edit.c	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/space_action/action_edit.c	2010-01-15 10:34:39 UTC (rev 26019)
@@ -1134,11 +1134,9 @@
 	for (ale= anim_data.first; ale; ale= ale->next) {
 		AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
 		if (adt) {
-			ListBase nlabackup;
-
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); 
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL);
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
 		else
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL);
@@ -1216,11 +1214,9 @@
 		AnimData *adt= ANIM_nla_mapping_get(ac, ale);
 		
 		if (adt) {
-			ListBase nlabackup;
-
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); 
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
 		//else if (ale->type == ACTTYPE_GPLAYER)
 		//	snap_gplayer_frames(ale->data, mode);
@@ -1335,11 +1331,9 @@
 		AnimData *adt= ANIM_nla_mapping_get(ac, ale);
 		
 		if (adt) {
-			ListBase nlabackup;
-
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup); 
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); 
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
 		//else if (ale->type == ACTTYPE_GPLAYER)
 		//	snap_gplayer_frames(ale->data, mode);

Modified: trunk/blender/source/blender/editors/space_action/action_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_select.c	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/space_action/action_select.c	2010-01-15 10:34:39 UTC (rev 26019)
@@ -416,12 +416,10 @@
 	for (ale= anim_data.first; ale; ale= ale->next) {
 		AnimData *adt= ANIM_nla_mapping_get(ac, ale);
 		
-		if (adt) {	
-			ListBase nlabackup;
-
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup);
+		if (adt) {
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
 		else {
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
@@ -663,19 +661,15 @@
 	/* select keys on the side where most data occurs */
 	for (ale= anim_data.first; ale; ale= ale->next) {
 		AnimData *adt= ANIM_nla_mapping_get(ac, ale);
-
-#if 0	// This does not work even in simple cases I tested - campbell
+		
 		if (adt) {
-			ListBase nlabackup;
-
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1, &nlabackup);
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
 		}
 		//else if (ale->type == ANIMTYPE_GPLAYER)
 		//	borderselect_gplayer_frames(ale->data, min, max, SELECT_ADD);
 		else
-#endif
 			ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
 	}
 	

Modified: trunk/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_draw.c	2010-01-15 10:02:02 UTC (rev 26018)
+++ trunk/blender/source/blender/editors/space_graph/graph_draw.c	2010-01-15 10:34:39 UTC (rev 26019)
@@ -819,11 +819,10 @@
 		FCurve *fcu= (FCurve *)ale->key_data;
 		FModifier *fcm= find_active_fmodifier(&fcu->modifiers);
 		AnimData *adt= ANIM_nla_mapping_get(ac, ale);
-		ListBase nlabackup;
 		
 		/* map keyframes for drawing if scaled F-Curve */
 		if (adt)
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0, &nlabackup); 
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0); 
 		
 		/* draw curve:
 		 *	- curve line may be result of one or more destructive modifiers or just the raw data,
@@ -909,7 +908,7 @@
 		
 		/* undo mapping of keyframes for drawing if scaled F-Curve */
 		if (adt)
-			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0, &nlabackup); 
+			ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0); 
 	}
 	
 	/* free list of curves */

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list