Beispiel #1
0
/* This function is used to apply operation to all keyframes, regardless of the type without needed an AnimListElem wrapper */
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{
	/* sanity checks */
	if (data == NULL)
		return 0;
	
	/* method to use depends on the type of keyframe data */
	switch (keytype) {
		/* direct keyframe data (these loops are exposed) */
		case ALE_FCURVE: /* F-Curve */
			return ANIM_fcurve_keyframes_loop(ked, data, key_ok, key_cb, fcu_cb);
		
		/* indirect 'summaries' (these are not exposed directly) 
		 * NOTE: must keep this code in sync with the drawing code and also the filtering code!
		 */
		case ALE_GROUP: /* action group */
			return agrp_keyframes_loop(ked, (bActionGroup *)data, key_ok, key_cb, fcu_cb);
		case ALE_ACT: /* action */
			return act_keyframes_loop(ked, (bAction *)data, key_ok, key_cb, fcu_cb);
			
		case ALE_OB: /* object */
			return ob_keyframes_loop(ked, ads, (Object *)data, key_ok, key_cb, fcu_cb);
		case ALE_SCE: /* scene */
			return scene_keyframes_loop(ked, ads, (Scene *)data, key_ok, key_cb, fcu_cb);
		case ALE_ALL: /* 'all' (DopeSheet summary) */
			return summary_keyframes_loop(ked, (bAnimContext *)data, key_ok, key_cb, fcu_cb);
	}
	
	return 0;
}
Beispiel #2
0
/* This function is used to loop over the keyframe data of an AnimData block */
static short adt_keyframes_loop(KeyframeEditData *ked, AnimData *adt, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag)
{
	/* sanity check */
	if (adt == NULL)
		return 0;
	
	/* drivers or actions? */
	if (filterflag & ADS_FILTER_ONLYDRIVERS) {
		FCurve *fcu;
		
		/* just loop through all F-Curves acting as Drivers */
		for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
			if (ANIM_fcurve_keyframes_loop(ked, fcu, key_ok, key_cb, fcu_cb))
				return 1;
		}
	}
	else if (adt->action) {
		/* call the function for actions */
		if (act_keyframes_loop(ked, adt->action, key_ok, key_cb, fcu_cb))
			return 1;
	}
	
	return 0;
}