[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27956] trunk/blender/source/blender/ editors: Batch renaming some keyframe editing internals in preparation for more generic keyframe editing API , allowing more niceties...

Joshua Leung aligorith at gmail.com
Fri Apr 2 14:02:39 CEST 2010


Revision: 27956
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27956
Author:   aligorith
Date:     2010-04-02 14:02:39 +0200 (Fri, 02 Apr 2010)

Log Message:
-----------
Batch renaming some keyframe editing internals in preparation for more generic keyframe editing API, allowing more niceties...

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_draw.c
    trunk/blender/source/blender/editors/animation/keyframes_edit.c
    trunk/blender/source/blender/editors/animation/keyframes_general.c
    trunk/blender/source/blender/editors/armature/poselib.c
    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_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_select.c
    trunk/blender/source/blender/editors/space_nla/nla_edit.c

Modified: trunk/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_draw.c	2010-04-02 11:39:40 UTC (rev 27955)
+++ trunk/blender/source/blender/editors/animation/anim_draw.c	2010-04-02 12:02:39 UTC (rev 27956)
@@ -307,11 +307,11 @@
 /* ------------------- */
 
 /* 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)
+static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
 {
 	/* 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;
+	AnimData *adt= (AnimData *)ked->data;
+	short only_keys= (short)ked->i1;
 	
 	/* adjust BezTriple handles only if allowed to */
 	if (only_keys == 0) {
@@ -325,11 +325,11 @@
 }
 
 /* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply", i.e. mapping points to NLA-mapped global time */
-static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt)
+static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
 {
 	/* 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;
+	AnimData *adt= (AnimData*)ked->data;
+	short only_keys= (short)ked->i1;
 	
 	/* adjust BezTriple handles only if allowed to */
 	if (only_keys == 0) {
@@ -349,16 +349,16 @@
  */
 void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys)
 {
-	BeztEditData bed;
-	BeztEditFunc map_cb;
+	KeyframeEditData ked;
+	KeyframeEditFunc map_cb;
 	
 	/* init edit data 
 	 *	- AnimData is stored in 'data'
 	 *	- only_keys is stored in 'i1'
 	 */
-	memset(&bed, 0, sizeof(BeztEditData));
-	bed.data= (void *)adt;
-	bed.i1= (int)only_keys;
+	memset(&ked, 0, sizeof(KeyframeEditData));
+	ked.data= (void *)adt;
+	ked.i1= (int)only_keys;
 	
 	/* get editing callback */
 	if (restore)
@@ -367,7 +367,7 @@
 		map_cb= bezt_nlamapping_apply;
 	
 	/* apply to F-Curve */
-	ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, map_cb, NULL);
+	ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, map_cb, NULL);
 }
 
 /* *************************************************** */
@@ -409,12 +409,12 @@
 /* ----------------------- */
 
 /* helper function for ANIM_unit_mapping_apply_fcurve -> mapping callback for unit mapping */
-static short bezt_unit_mapping_apply (BeztEditData *bed, BezTriple *bezt)
+static short bezt_unit_mapping_apply (KeyframeEditData *ked, BezTriple *bezt)
 {
 	/* mapping factor is stored in f1, flags are stored in i1 */
-	short only_keys= (bed->i1 & ANIM_UNITCONV_ONLYKEYS);
-	short sel_vs= (bed->i1 & ANIM_UNITCONV_SELVERTS);
-	float fac= bed->f1;
+	short only_keys= (ked->i1 & ANIM_UNITCONV_ONLYKEYS);
+	short sel_vs= (ked->i1 & ANIM_UNITCONV_SELVERTS);
+	float fac= ked->f1;
 	
 	/* adjust BezTriple handles only if allowed to */
 	if (only_keys == 0) {
@@ -433,8 +433,8 @@
 /* Apply/Unapply units conversions to keyframes */
 void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short flag)
 {
-	BeztEditData bed;
-	BeztEditFunc sel_cb;
+	KeyframeEditData ked;
+	KeyframeEditFunc sel_cb;
 	float fac;
 	
 	/* calculate mapping factor, and abort if nothing to change */
@@ -446,9 +446,9 @@
 	 *	- mapping factor is stored in f1
 	 *	- flags are stored in 'i1'
 	 */
-	memset(&bed, 0, sizeof(BeztEditData));
-	bed.f1= (float)fac;
-	bed.i1= (int)flag;
+	memset(&ked, 0, sizeof(KeyframeEditData));
+	ked.f1= (float)fac;
+	ked.i1= (int)flag;
 	
 	/* only selected? */
 	if (flag & ANIM_UNITCONV_ONLYSEL)
@@ -457,7 +457,7 @@
 		sel_cb= NULL;
 	
 	/* apply to F-Curve */
-	ANIM_fcurve_keys_bezier_loop(&bed, fcu, sel_cb, bezt_unit_mapping_apply, NULL);
+	ANIM_fcurve_keyframes_loop(&ked, fcu, sel_cb, bezt_unit_mapping_apply, NULL);
 	
 	// FIXME: loop here for samples should be generalised
 	// TODO: only sel?

Modified: trunk/blender/source/blender/editors/animation/keyframes_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_edit.c	2010-04-02 11:39:40 UTC (rev 27955)
+++ trunk/blender/source/blender/editors/animation/keyframes_edit.c	2010-04-02 12:02:39 UTC (rev 27956)
@@ -61,7 +61,7 @@
 /* This file defines an API and set of callback-operators for non-destructive editing of keyframe data.
  *
  * Two API functions are defined for actually performing the operations on the data:
- *			ANIM_fcurve_keys_bezier_loop()
+ *			ANIM_fcurve_keyframes_loop()
  * which take the data they operate on, a few callbacks defining what operations to perform.
  *
  * As operators which work on keyframes usually apply the same operation on all BezTriples in 
@@ -84,56 +84,56 @@
 /* This function is used to loop over BezTriples in the given F-Curve, applying a given 
  * operation on them, and optionally applies an F-Curve validation function afterwards.
  */
-short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb) 
+short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb) 
 {
-	 BezTriple *bezt;
-	 int i;
-	
+	BezTriple *bezt;
+	int i;
+
 	/* sanity check */
 	if (ELEM(NULL, fcu, fcu->bezt))
 		return 0;
-	
+
 	/* set the F-Curve into the editdata so that it can be accessed */
-	 if (bed) {
-		 bed->fcu= fcu;
-		 bed->curIndex= 0;
-	 }
-	
+	if (ked) {
+		ked->fcu= fcu;
+		ked->curIndex= 0;
+	}
+
 	/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
-	 if (bezt_cb) {
+	if (bezt_cb) {
 		/* if there's a validation func, include that check in the loop 
 		 * (this is should be more efficient than checking for it in every loop)
 		 */
 		if (bezt_ok) {
 			for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
-				if (bed) bed->curIndex= i;
+				if (ked) ked->curIndex= i;
 				
 				/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
-				if (bezt_ok(bed, bezt)) {
+				if (bezt_ok(ked, bezt)) {
 					/* Exit with return-code '1' if function returns positive
 					 * This is useful if finding if some BezTriple satisfies a condition.
 					 */
-					if (bezt_cb(bed, bezt)) return 1;
+					if (bezt_cb(ked, bezt)) return 1;
 				}
 			}
 		}
 		else {
 			for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
-				if (bed) bed->curIndex= i;
+				if (ked) ked->curIndex= i;
 				
 				/* Exit with return-code '1' if function returns positive
-				 * This is useful if finding if some BezTriple satisfies a condition.
-				 */
-				if (bezt_cb(bed, bezt)) return 1;
+				* This is useful if finding if some BezTriple satisfies a condition.
+				*/
+				if (bezt_cb(ked, bezt)) return 1;
 			}
 		}
-	 }
+	}
 	
 	/* unset the F-Curve from the editdata now that it's done */
-	 if (bed) {
-		 bed->fcu= NULL;
-		 bed->curIndex= 0;
-	 }
+	if (ked) {
+		ked->fcu= NULL;
+		ked->curIndex= 0;
+	}
 
 	/* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
 	if (fcu_cb)
@@ -146,7 +146,7 @@
 /* -------------------------------- Further Abstracted (Not Exposed Directly) ----------------------------- */
 
 /* This function is used to loop over the keyframe data in an Action Group */
-static short agrp_keys_bezier_loop(BeztEditData *bed, bActionGroup *agrp, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
+static short agrp_keyframes_loop(KeyframeEditData *ked, bActionGroup *agrp, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb)
 {
 	FCurve *fcu;
 	
@@ -156,7 +156,7 @@
 	
 	/* only iterate over the F-Curves that are in this group */
 	for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) {
-		if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
+		if (ANIM_fcurve_keyframes_loop(ked, fcu, bezt_ok, bezt_cb, fcu_cb))
 			return 1;
 	}
 	
@@ -164,7 +164,7 @@
 }
 
 /* This function is used to loop over the keyframe data in an Action */
-static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
+static short act_keyframes_loop(KeyframeEditData *ked, bAction *act, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb)
 {
 	FCurve *fcu;
 	
@@ -174,7 +174,7 @@
 	
 	/* just loop through all F-Curves */
 	for (fcu= act->curves.first; fcu; fcu= fcu->next) {
-		if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
+		if (ANIM_fcurve_keyframes_loop(ked, fcu, bezt_ok, bezt_cb, fcu_cb))
 			return 1;
 	}
 	
@@ -182,7 +182,7 @@
 }
 
 /* This function is used to loop over the keyframe data of an AnimData block */
-static short adt_keys_bezier_loop(BeztEditData *bed, AnimData *adt, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
+static short adt_keyframes_loop(KeyframeEditData *ked, AnimData *adt, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
 {
 	/* sanity check */
 	if (adt == NULL)
@@ -194,13 +194,13 @@
 		
 		/* just loop through all F-Curves acting as Drivers */
 		for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
-			if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
+			if (ANIM_fcurve_keyframes_loop(ked, fcu, bezt_ok, bezt_cb, fcu_cb))
 				return 1;
 		}
 	}
 	else if (adt->action) {
 		/* call the function for actions */
-		if (act_keys_bezier_loop(bed, adt->action, bezt_ok, bezt_cb, fcu_cb))
+		if (act_keyframes_loop(ked, adt->action, bezt_ok, bezt_cb, fcu_cb))
 			return 1;
 	}
 	
@@ -208,7 +208,7 @@
 }
 
 /* This function is used to loop over the keyframe data in an Object */
-static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
+static short ob_keyframes_loop(KeyframeEditData *ked, Object *ob, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
 {
 	Key *key= ob_get_key(ob);
 	
@@ -218,13 +218,13 @@
 	
 	/* firstly, Object's own AnimData */
 	if (ob->adt) {
-		if (adt_keys_bezier_loop(bed, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list