Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-04-10 16:06:31 +0400
committerJoshua Leung <aligorith@gmail.com>2009-04-10 16:06:31 +0400
commitbe8b7ead51a5efb5dbd762075ee52812465ba8d6 (patch)
treea86d3991a8d4532f2b5a45717d3216758e9a80e5 /source/blender/editors/animation/keyframes_edit.c
parent487561882dfd14dfcd7af16132e65ef854d9636d (diff)
Action Editor - Part 2 of Code Cleanups
Nothing much to see here... there's still a few things to recode a bit nicer...
Diffstat (limited to 'source/blender/editors/animation/keyframes_edit.c')
-rw-r--r--source/blender/editors/animation/keyframes_edit.c75
1 files changed, 68 insertions, 7 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 44814812c76..748f4de7122 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -36,12 +36,12 @@
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
-#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
+#include "DNA_world_types.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
@@ -71,7 +71,7 @@
*/
/* ************************************************************************** */
-/* IPO Editing Loops - Exposed API */
+/* Keyframe Editing Loops - Exposed API */
/* --------------------------- Base Functions ------------------------------------ */
@@ -121,14 +121,14 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
return 0;
}
-/* -------------------------------- Further Abstracted ----------------------------- */
+/* -------------------------------- 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)
{
FCurve *fcu;
- /* only iterate over the action-channels and their sub-channels that are in this group */
+ /* 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))
return 1;
@@ -144,17 +144,73 @@ static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc
/* just loop through all F-Curves */
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
- ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb);
+ if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
+ return 1;
}
return 0;
}
-/* --- */
+/* 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)
+{
+ /* 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_keys_bezier_loop(bed, 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))
+ return 1;
+ }
+
+ return 0;
+}
+
+/* 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)
+{
+ Key *key= ob_get_key(ob);
+
+ /* firstly, Object's own AnimData */
+ if (ob->adt)
+ adt_keys_bezier_loop(bed, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag);
+
+ /* shapekeys */
+ if ((key && key->adt) && !(filterflag & ADS_FILTER_NOSHAPEKEYS))
+ adt_keys_bezier_loop(bed, key->adt, bezt_ok, bezt_cb, fcu_cb, filterflag);
+
+ // FIXME: add materials, etc. (but drawing code doesn't do it yet too! :)
+
+ return 0;
+}
+
+/* This function is used to loop over the keyframe data in a Scene */
+static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
+{
+ World *wo= sce->world;
+
+ /* Scene's own animation */
+ if (sce->adt)
+ adt_keys_bezier_loop(bed, sce->adt, bezt_ok, bezt_cb, fcu_cb, filterflag);
+
+ /* World */
+ if (wo && wo->adt)
+ adt_keys_bezier_loop(bed, wo->adt, bezt_ok, bezt_cb, fcu_cb, filterflag);
+
+ return 0;
+}
+/* --- */
/* This function is used to apply operation to all keyframes, regardless of the type */
-short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
+short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
/* sanity checks */
if (ale == NULL)
@@ -173,6 +229,11 @@ short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, B
return agrp_keys_bezier_loop(bed, (bActionGroup *)ale->data, bezt_ok, bezt_cb, fcu_cb);
case ALE_ACT: /* action */
return act_keys_bezier_loop(bed, (bAction *)ale->data, bezt_ok, bezt_cb, fcu_cb);
+
+ case ALE_OB: /* object */
+ return ob_keys_bezier_loop(bed, (Object *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
+ case ALE_SCE: /* scene */
+ return scene_keys_bezier_loop(bed, (Scene *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
}
return 0;