From 8c479bc9332bcb4a3b6b0e47346287f491532729 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 20 Jan 2009 11:07:42 +0000 Subject: Animato - Restoring most of Action Editor * Streamlined the filtering code to remove a few redundant options, which required tweaking the code for most tools * F-Curves are simply displayed using their full paths right now. This should eventually be the UI-string stored in RNA, but right now there are still a few missing things. * There are a few tools which are not available yet which were available in 2.5 before Animato was added: - Copy/Paste - Rearrange channels Also, the DopeSheet is not totally functional (in terms of displaying animation data for sub-object data yet). That will be added tomorrow. * Added 'Action Group' pointer to F-Curves, as it will be handy for allowing Bone channels to still remain grouped as they were before with the Action Channels. However, reintroducing such a structure to the data-storage is not anticipated... --- source/blender/blenkernel/BKE_ipo.h | 4 +- source/blender/blenloader/intern/readfile.c | 9 +- source/blender/editors/animation/anim_channels.c | 370 ++++-------------- source/blender/editors/animation/anim_draw.c | 35 +- source/blender/editors/animation/anim_filter.c | 435 +++++---------------- source/blender/editors/animation/keyframes_draw.c | 154 ++------ source/blender/editors/animation/keyframes_edit.c | 173 ++------ source/blender/editors/include/ED_anim_api.h | 62 +-- source/blender/editors/include/ED_keyframes_draw.h | 9 +- source/blender/editors/include/ED_keyframes_edit.h | 14 +- source/blender/editors/space_action/action_draw.c | 206 +--------- source/blender/editors/space_action/action_edit.c | 75 ++-- .../blender/editors/space_action/action_header.c | 11 +- .../blender/editors/space_action/action_select.c | 376 ++++++++---------- .../editors/transform/transform_conversions.c | 10 +- source/blender/makesdna/DNA_action_types.h | 9 +- source/blender/makesdna/DNA_anim_types.h | 3 + 17 files changed, 500 insertions(+), 1455 deletions(-) diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h index 98745e9a0f2..fae62b4a23e 100644 --- a/source/blender/blenkernel/BKE_ipo.h +++ b/source/blender/blenkernel/BKE_ipo.h @@ -38,9 +38,11 @@ extern "C" { /* -------- IPO-Curve (Bezier) Calculations ---------- */ +// xxx perhaps this should be in curve api not in anim api void correct_bezpart(float *v1, float *v2, float *v3, float *v4); - + +// XXX this file will soon be depreceated... #if 0 // XXX old animation system typedef struct CfraElem { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 94db9c9d192..2e6a8468dae 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1837,6 +1837,9 @@ static void direct_link_fcurves(FileData *fd, ListBase *list) /* rna path */ fcu->rna_path= newdataadr(fd, fcu->rna_path); + /* group */ + fcu->grp= newdataadr(fd, fcu->grp); + /* driver */ fcu->driver= newdataadr(fd, fcu->driver); if (fcu->driver) { @@ -1917,10 +1920,8 @@ static void direct_link_action(FileData *fd, bAction *act) direct_link_fcurves(fd, &act->curves); for (agrp = act->groups.first; agrp; agrp= agrp->next) { - if (agrp->channels.first) { - agrp->channels.first= newdataadr(fd, agrp->channels.first); - agrp->channels.last= newdataadr(fd, agrp->channels.last); - } + agrp->channels.first= newdataadr(fd, agrp->channels.first); + agrp->channels.last= newdataadr(fd, agrp->channels.last); } } diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c index b87a8ad7181..44d85f2f153 100644 --- a/source/blender/editors/animation/anim_channels.c +++ b/source/blender/editors/animation/anim_channels.c @@ -42,11 +42,11 @@ #include "BLI_arithb.h" #include "DNA_listBase.h" +#include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" #include "DNA_curve_types.h" -#include "DNA_ipo_types.h" #include "DNA_object_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" @@ -102,24 +102,6 @@ /* -------------------------- Internal Tools -------------------------------- */ -/* set the given Action Channel to be the 'active' one in its Action */ -static void action_set_active_achan (bAction *act, bActionChannel *achan) -{ - bActionChannel *chan; - - /* sanity check */ - if (act == NULL) - return; - - /* clear active flag on all others */ - for (chan= act->chanbase.first; chan; chan= chan->next) - chan->flag &= ~ACHAN_HILIGHTED; - - /* set the given Action Channel to be the active one */ - if (achan) - achan->flag |= ACHAN_HILIGHTED; -} - /* set the given Action Group to be the 'active' one in its Action */ static void action_set_active_agrp (bAction *act, bActionGroup *agrp) { @@ -153,9 +135,6 @@ void ANIM_action_set_active_channel (void *data, short datatype, void *channel_d return; switch (channel_type) { - case ANIMTYPE_ACHAN: - action_set_active_achan((bAction *)data, (bActionChannel *)channel_data); - break; case ANIMTYPE_GROUP: action_set_active_agrp((bAction *)data, (bActionGroup *)channel_data); break; @@ -190,23 +169,15 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short sel= ACHANNEL_SETFLAG_CLEAR; break; case ANIMTYPE_FILLACTD: - if (ale->flag & ACTC_SELECTED) + if (ale->flag & ACT_SELECTED) sel= ACHANNEL_SETFLAG_CLEAR; break; case ANIMTYPE_GROUP: if (ale->flag & AGRP_SELECTED) sel= ACHANNEL_SETFLAG_CLEAR; break; - case ANIMTYPE_ACHAN: - if (ale->flag & ACHAN_SELECTED) - sel= ACHANNEL_SETFLAG_CLEAR; - break; - case ANIMTYPE_CONCHAN: - if (ale->flag & CONSTRAINT_CHANNEL_SELECT) - sel= ACHANNEL_SETFLAG_CLEAR; - break; - case ANIMTYPE_ICU: - if (ale->flag & IPO_SELECT) + case ANIMTYPE_FCURVE: + if (ale->flag & FCURVE_SELECTED) sel= ACHANNEL_SETFLAG_CLEAR; break; } @@ -229,7 +200,7 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short { bAction *act= (bAction *)ale->data; - ACHANNEL_SET_FLAG(act, sel, ACTC_SELECTED); + ACHANNEL_SET_FLAG(act, sel, ACT_SELECTED); } break; case ANIMTYPE_GROUP: @@ -240,29 +211,12 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short agrp->flag &= ~AGRP_ACTIVE; } break; - case ANIMTYPE_ACHAN: - { - bActionChannel *achan= (bActionChannel *)ale->data; - - ACHANNEL_SET_FLAG(achan, sel, ACHAN_SELECTED); - - //select_poseelement_by_name(achan->name, sel); // XXX - achan->flag &= ~ACHAN_HILIGHTED; - } - break; - case ANIMTYPE_CONCHAN: + case ANIMTYPE_FCURVE: { - bConstraintChannel *conchan= (bConstraintChannel *)ale->data; + FCurve *fcu= (FCurve *)ale->data; - ACHANNEL_SET_FLAG(conchan, sel, CONSTRAINT_CHANNEL_SELECT); - } - break; - case ANIMTYPE_ICU: - { - IpoCurve *icu= (IpoCurve *)ale->data; - - ACHANNEL_SET_FLAG(icu, sel, IPO_SELECT); - icu->flag &= ~IPO_ACTIVE; + ACHANNEL_SET_FLAG(fcu, sel, FCURVE_SELECTED); + fcu->flag &= ~FCURVE_ACTIVE; } break; } @@ -278,6 +232,8 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short /* ****************** Rearrange Channels Operator ******************* */ /* This operator only works for Action Editor mode for now, as having it elsewhere makes things difficult */ +#if 0 // XXX old animation system - needs to be updated for new system... + /* constants for channel rearranging */ /* WARNING: don't change exising ones without modifying rearrange func accordingly */ enum { @@ -650,6 +606,7 @@ void ANIM_OT_channels_move_bottom (wmOperatorType *ot) RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_BOTTOM, "Direction", ""); } +#endif // XXX old animation system - needs to be updated for new system... /* ********************** Set Flags Operator *********************** */ @@ -704,60 +661,16 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode) } } break; - case ANIMTYPE_ACHAN: + case ANIMTYPE_FCURVE: { - bActionChannel *achan= (bActionChannel *)ale->data; - - /* 'protect' and 'mute' */ - if ((setting == ACHANNEL_SETTING_MUTE) && (achan->ipo)) { - Ipo *ipo= achan->ipo; - - /* mute */ - if (mode == 0) - ipo->muteipo= 0; - else if (mode == 1) - ipo->muteipo= 1; - else if (mode == 2) - ipo->muteipo= (ipo->muteipo) ? 0 : 1; - } - else if (setting == ACHANNEL_SETTING_PROTECT) { - /* protected */ - ACHANNEL_SET_FLAG(achan, mode, ACHAN_PROTECTED); - } - } - break; - case ANIMTYPE_CONCHAN: - { - bConstraintChannel *conchan= (bConstraintChannel *)ale->data; - - /* 'protect' and 'mute' */ - if ((setting == ACHANNEL_SETTING_MUTE) && (conchan->ipo)) { - Ipo *ipo= conchan->ipo; - - /* mute */ - if (mode == 0) - ipo->muteipo= 0; - else if (mode == 1) - ipo->muteipo= 1; - else if (mode == 2) - ipo->muteipo= (ipo->muteipo) ? 0 : 1; - } - else if (setting == ACHANNEL_SETTING_PROTECT) { - /* protect */ - ACHANNEL_SET_FLAG(conchan, mode, CONSTRAINT_CHANNEL_PROTECTED); - } - } - break; - case ANIMTYPE_ICU: - { - IpoCurve *icu= (IpoCurve *)ale->data; + FCurve *fcu= (FCurve *)ale->data; /* mute */ if (setting == ACHANNEL_SETTING_MUTE) { - ACHANNEL_SET_FLAG(icu, mode, IPO_MUTE); + ACHANNEL_SET_FLAG(fcu, mode, FCURVE_MUTED); } else if (setting == ACHANNEL_SETTING_PROTECT) { - ACHANNEL_SET_FLAG(icu, mode, IPO_PROTECT); + ACHANNEL_SET_FLAG(fcu, mode, FCURVE_PROTECTED); } } break; @@ -954,28 +867,11 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele agrp->flag &= ~AGRP_ACTIVE; } break; - case ANIMTYPE_ACHAN: /* action channel */ - case ANIMTYPE_FILLIPO: /* expand ipo curves = action channel */ - case ANIMTYPE_FILLCON: /* expand constraint channels = action channel */ - { - bActionChannel *achan= (bActionChannel *)ale->data; - - ACHANNEL_SET_FLAG(achan, selectmode, ACHAN_SELECTED); - achan->flag &= ~ACHAN_HILIGHTED; - } - break; - case ANIMTYPE_CONCHAN: /* constraint channel */ + case ANIMTYPE_FCURVE: /* F-Curve channel */ { - bConstraintChannel *conchan = (bConstraintChannel *)ale->data; + FCurve *fcu = (FCurve *)ale->data; - ACHANNEL_SET_FLAG(conchan, selectmode, CONSTRAINT_CHANNEL_SELECT); - } - break; - case ANIMTYPE_ICU: /* ipo-curve channel */ - { - IpoCurve *icu = (IpoCurve *)ale->data; - - ACHANNEL_SET_FLAG(icu, selectmode, IPO_SELECT); + ACHANNEL_SET_FLAG(fcu, selectmode, FCURVE_SELECTED); } break; case ANIMTYPE_GPLAYER: /* grease-pencil layer */ @@ -986,14 +882,6 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele } break; } - - /* select action-channel 'owner' */ - if ((ale->owner) && (ale->ownertype == ANIMTYPE_ACHAN)) { - bActionChannel *achano= (bActionChannel *)ale->owner; - - ACHANNEL_SET_FLAG(achano, selectmode, ACHAN_SELECTED); - achano->flag &= ~ACHAN_HILIGHTED; - } } /* set minimum extent to be the maximum of the next channel */ @@ -1074,7 +962,7 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s /* get the channel that was clicked on */ /* filter channels */ - filter= (ANIMFILTER_FORDRAWING | ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); filter= ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* get channel from index */ @@ -1106,7 +994,7 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s if (x < 16) { /* toggle expand */ - ob->nlaflag ^= OB_ADS_COLLAPSED; + ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX } else { /* set selection status */ @@ -1134,28 +1022,16 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s } } break; - case ANIMTYPE_FILLIPOD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWIPO; - } - break; case ANIMTYPE_FILLACTD: { bAction *act= (bAction *)ale->data; - act->flag ^= ACTC_EXPANDED; - } - break; - case ANIMTYPE_FILLCOND: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWCONS; + act->flag ^= ACT_EXPANDED; } break; case ANIMTYPE_FILLMATD: { Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWMATS; + ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX } break; @@ -1235,152 +1111,59 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s } } break; - case ANIMTYPE_ACHAN: - { - bActionChannel *achan= (bActionChannel *)ale->data; - short offset= (ac->datatype == ANIMCONT_DOPESHEET)? 21 : 0; - - if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { - /* toggle protect */ - achan->flag ^= ACHAN_PROTECTED; - } - else if ((x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) && (achan->ipo)) { - /* toggle mute */ - achan->ipo->muteipo = (achan->ipo->muteipo)? 0: 1; - } - else if (x <= (offset+17)) { - /* toggle expand */ - achan->flag ^= ACHAN_EXPANDED; - } - else { - /* select/deselect achan */ - if (selectmode == SELECT_INVERT) { - /* invert selection of this channel only */ - achan->flag ^= ACHAN_SELECTED; - } - else { - /* replace, so make sure only this channel is selected after everything has happened) */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - achan->flag |= ACHAN_SELECTED; - } - - /* if channel is selected now, and we're in Action Editor mode (so that we have pointer to active action), - * we can make this channel the 'active' one in that action - */ - if ((achan->flag & ACHAN_SELECTED) && (ac->datatype == ANIMCONT_ACTION)) - action_set_active_achan((bAction *)ac->data, achan); - } - } - break; - case ANIMTYPE_FILLIPO: - { - bActionChannel *achan= (bActionChannel *)ale->data; - - achan->flag ^= ACHAN_SHOWIPO; - - if ((x > 24) && (achan->flag & ACHAN_SHOWIPO)) { - /* select+make active achan */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - achan->flag |= ACHAN_SELECTED; - - /* if channel is selected now, and we're in Action Editor mode (so that we have pointer to active action), - * we can make this channel the 'active' one in that action - */ - if (ac->datatype == ANIMCONT_ACTION) - action_set_active_achan((bAction *)ac->data, achan); - } + case ANIMTYPE_FCURVE: + { + FCurve *fcu= (FCurve *)ale->data; + + if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { + /* toggle protection */ + fcu->flag ^= FCURVE_PROTECTED; } - break; - case ANIMTYPE_FILLCON: - { - bActionChannel *achan= (bActionChannel *)ale->data; - - achan->flag ^= ACHAN_SHOWCONS; - - if ((x > 24) && (achan->flag & ACHAN_SHOWCONS)) { - /* select+make active achan */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - achan->flag |= ACHAN_SELECTED; - - /* if channel is selected now, and we're in Action Editor mode (so that we have pointer to active action), - * we can make this channel the 'active' one in that action - */ - if (ac->datatype == ANIMCONT_ACTION) - action_set_active_achan((bAction *)ac->data, achan); - } + else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) { + /* toggle mute */ + fcu->flag ^= FCURVE_MUTED; } - break; - case ANIMTYPE_ICU: - { - IpoCurve *icu= (IpoCurve *)ale->data; - - if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { - /* toggle protection */ - icu->flag ^= IPO_PROTECT; - } - else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) { - /* toggle mute */ - icu->flag ^= IPO_MUTE; - } - else { - /* select/deselect */ - icu->flag ^= IPO_SELECT; - } + else { + /* select/deselect */ + fcu->flag ^= FCURVE_SELECTED; } + } break; - case ANIMTYPE_CONCHAN: - { - bConstraintChannel *conchan= (bConstraintChannel *)ale->data; - - if (x >= (ACHANNEL_NAMEWIDTH-16)) { - /* toggle protection */ - conchan->flag ^= CONSTRAINT_CHANNEL_PROTECTED; - } - else if ((x >= (ACHANNEL_NAMEWIDTH-32)) && (conchan->ipo)) { - /* toggle mute */ - conchan->ipo->muteipo = (conchan->ipo->muteipo)? 0: 1; - } - else { - /* select/deselect */ - conchan->flag ^= CONSTRAINT_CHANNEL_SELECT; - } - } - break; case ANIMTYPE_GPDATABLOCK: - { - bGPdata *gpd= (bGPdata *)ale->data; - - /* toggle expand */ - gpd->flag ^= GP_DATA_EXPAND; - } - break; + { + bGPdata *gpd= (bGPdata *)ale->data; + + /* toggle expand */ + gpd->flag ^= GP_DATA_EXPAND; + } + break; case ANIMTYPE_GPLAYER: - { + { #if 0 // XXX future of this is unclear - bGPdata *gpd= (bGPdata *)ale->owner; - bGPDlayer *gpl= (bGPDlayer *)ale->data; - - if (x >= (ACHANNEL_NAMEWIDTH-16)) { - /* toggle lock */ - gpl->flag ^= GP_LAYER_LOCKED; - } - else if (x >= (ACHANNEL_NAMEWIDTH-32)) { - /* toggle hide */ - gpl->flag ^= GP_LAYER_HIDE; - } - else { - /* select/deselect */ - //if (G.qual & LR_SHIFTKEY) { - //select_gplayer_channel(gpd, gpl, SELECT_INVERT); - //} - //else { - //deselect_gpencil_layers(data, 0); - //select_gplayer_channel(gpd, gpl, SELECT_INVERT); - //} - } -#endif // XXX future of this is unclear + bGPdata *gpd= (bGPdata *)ale->owner; + bGPDlayer *gpl= (bGPDlayer *)ale->data; + + if (x >= (ACHANNEL_NAMEWIDTH-16)) { + /* toggle lock */ + gpl->flag ^= GP_LAYER_LOCKED; } - break; + else if (x >= (ACHANNEL_NAMEWIDTH-32)) { + /* toggle hide */ + gpl->flag ^= GP_LAYER_HIDE; + } + else { + /* select/deselect */ + //if (G.qual & LR_SHIFTKEY) { + //select_gplayer_channel(gpd, gpl, SELECT_INVERT); + //} + //else { + //deselect_gpencil_layers(data, 0); + //select_gplayer_channel(gpd, gpl, SELECT_INVERT); + //} + } +#endif // XXX future of this is unclear + } + break; case ANIMTYPE_SHAPEKEY: /* TODO: shapekey channels cannot be selected atm... */ break; @@ -1472,10 +1255,11 @@ void ED_operatortypes_animchannels(void) WM_operatortype_append(ANIM_OT_channels_disable_setting); WM_operatortype_append(ANIM_OT_channels_toggle_setting); - WM_operatortype_append(ANIM_OT_channels_move_up); - WM_operatortype_append(ANIM_OT_channels_move_down); - WM_operatortype_append(ANIM_OT_channels_move_top); - WM_operatortype_append(ANIM_OT_channels_move_bottom); + // XXX these need to be updated for new system... todo... + //WM_operatortype_append(ANIM_OT_channels_move_up); + //WM_operatortype_append(ANIM_OT_channels_move_down); + //WM_operatortype_append(ANIM_OT_channels_move_top); + //WM_operatortype_append(ANIM_OT_channels_move_bottom); } void ED_keymap_animchannels(wmWindowManager *wm) @@ -1502,10 +1286,10 @@ void ED_keymap_animchannels(wmWindowManager *wm) WM_keymap_add_item(keymap, "ANIM_OT_channels_disable_setting", WKEY, KM_PRESS, KM_ALT, 0); /* rearranging - actions only */ - WM_keymap_add_item(keymap, "ANIM_OT_channels_move_up", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "ANIM_OT_channels_move_down", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "ANIM_OT_channels_move_to_top", PAGEUPKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); - WM_keymap_add_item(keymap, "ANIM_OT_channels_move_to_bottom", PAGEDOWNKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_up", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0); + //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_down", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0); + //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_to_top", PAGEUPKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + //WM_keymap_add_item(keymap, "ANIM_OT_channels_move_to_bottom", PAGEDOWNKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); } /* ************************************************************************** */ diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 463141b3c97..843cadd4736 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -29,9 +29,9 @@ #include #include +#include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_curve_types.h" -#include "DNA_ipo_types.h" #include "DNA_object_types.h" #include "DNA_space_types.h" #include "DNA_scene_types.h" @@ -45,7 +45,7 @@ #include "BKE_action.h" #include "BKE_context.h" #include "BKE_global.h" -#include "BKE_ipo.h" +#include "BKE_fcurve.h" #include "BKE_object.h" #include "BKE_screen.h" #include "BKE_utildefines.h" @@ -128,7 +128,9 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) /* Draw dark green line if slow-parenting/time-offset is enabled */ if (flag & DRAWCFRA_SHOW_TIMEOFS) { Object *ob= (scene->basact) ? (scene->basact->object) : 0; - if ((ob) && (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)!=0.0)) { + + // XXX ob->ipoflag is depreceated! + if ((ob) && (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)!=0.0f)) { vec[0]-= give_timeoffset(ob); /* could avoid calling twice */ UI_ThemeColorShade(TH_CFRAME, -30); @@ -294,11 +296,11 @@ static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt) -/* Apply/Unapply NLA mapping to all keyframes in the nominated IPO-Curve - * - restore = whether to map points back to ipo-time +/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve + * - 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_ipocurve(Object *ob, IpoCurve *icu, short restore, short only_keys) +void ANIM_nla_mapping_apply_fcurve(Object *ob, FCurve *fcu, short restore, short only_keys) { BeztEditData bed; BeztEditFunc map_cb; @@ -317,25 +319,8 @@ void ANIM_nla_mapping_apply_ipocurve(Object *ob, IpoCurve *icu, short restore, s else map_cb= bezt_nlamapping_apply; - /* apply to IPO curve */ - ANIM_icu_keys_bezier_loop(&bed, icu, NULL, map_cb, NULL); + /* apply to F-Curve */ + ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, map_cb, NULL); } -/* Apply/Unapply NLA mapping to all keyframes in the nominated IPO block - * - restore = whether to map points back to ipo-time - * - only_keys = whether to only adjust the location of the center point of beztriples - */ -// was called actstrip_map_ipo_keys() -void ANIM_nla_mapping_apply_ipo(Object *ob, Ipo *ipo, short restore, short only_keys) -{ - IpoCurve *icu; - - if (ipo == NULL) return; - - /* loop through all ipo curves, adjusting the times of the selected keys */ - for (icu= ipo->curve.first; icu; icu= icu->next) { - ANIM_nla_mapping_apply_ipocurve(ob, icu, restore, only_keys); - } -} - /* *************************************************** */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2bf433dab46..177ee25bff6 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -49,6 +49,7 @@ #include "DNA_listBase.h" #include "DNA_ID.h" +#include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_constraint_types.h" #include "DNA_camera_types.h" @@ -147,8 +148,8 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction) case SACTCONT_ACTION: /* 'Action Editor' */ /* if not pinned, sync with active object */ if (saction->pin == 0) { - if (ac->obact) - saction->action = ac->obact->action; + if (ac->obact && ac->obact->adt) + saction->action = ac->obact->adt->action; else saction->action= NULL; } @@ -269,6 +270,9 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) /* ************************************************************ */ /* Blender Data <-- Filter --> Channels to be operated on */ +/* quick macro to test if AnimData is usable */ +#define ANIMDATA_HAS_KEYS(id) ((id)->adt && (id)->adt->action) + /* ----------- 'Private' Stuff --------------- */ /* this function allocates memory for a new bAnimListElem struct for the @@ -288,9 +292,9 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->owner= owner; ale->ownertype= ownertype; - if ((owner) && (ownertype == ANIMTYPE_ACHAN)) { - bActionChannel *ochan= (bActionChannel *)owner; - ale->grp= ochan->grp; + if ((owner) && (ownertype == ANIMTYPE_FCURVE)) { + FCurve *ofcu= (FCurve *)owner; + ale->grp= ofcu->grp; } else ale->grp= NULL; @@ -318,26 +322,6 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->datatype= ALE_ACT; } break; - case ANIMTYPE_FILLIPOD: - { - Object *ob= (Object *)data; - - ale->flag= FILTER_IPO_OBJC(ob); - - ale->key_data= ob->ipo; - ale->datatype= ALE_IPO; - } - break; - case ANIMTYPE_FILLCOND: - { - Object *ob= (Object *)data; - - ale->flag= FILTER_CON_OBJC(ob); - - ale->key_data= NULL; - ale->datatype= ALE_NONE; - } - break; case ANIMTYPE_FILLMATD: { Object *ob= (Object *)data; @@ -352,51 +336,56 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s case ANIMTYPE_DSMAT: { Material *ma= (Material *)data; + AnimData *adt= ma->adt; ale->flag= FILTER_MAT_OBJD(ma); - ale->key_data= ma->ipo; - ale->datatype= ALE_IPO; + ale->key_data= adt->action; + ale->datatype= ALE_ACT; } break; case ANIMTYPE_DSLAM: { Lamp *la= (Lamp *)data; + AnimData *adt= la->adt; ale->flag= FILTER_LAM_OBJD(la); - ale->key_data= la->ipo; - ale->datatype= ALE_IPO; + ale->key_data= adt->action; + ale->datatype= ALE_ACT; } break; case ANIMTYPE_DSCAM: { Camera *ca= (Camera *)data; + AnimData *adt= ca->adt; ale->flag= FILTER_CAM_OBJD(ca); - ale->key_data= ca->ipo; - ale->datatype= ALE_IPO; + ale->key_data= adt->action; + ale->datatype= ALE_ACT; } break; case ANIMTYPE_DSCUR: { Curve *cu= (Curve *)data; + AnimData *adt= cu->adt; ale->flag= FILTER_CUR_OBJD(cu); - ale->key_data= cu->ipo; - ale->datatype= ALE_IPO; + ale->key_data= adt->action; + ale->datatype= ALE_ACT; } break; case ANIMTYPE_DSSKEY: { Key *key= (Key *)data; + AnimData *adt= key->adt; - ale->flag= FILTER_SKE_OBJD(key); + ale->flag= FILTER_SKE_OBJD(key); - ale->key_data= key->ipo; - ale->datatype= ALE_IPO; + ale->key_data= adt->action; + ale->datatype= ALE_ACT; } break; @@ -410,86 +399,14 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->datatype= ALE_GROUP; } break; - case ANIMTYPE_ACHAN: - { - bActionChannel *achan= (bActionChannel *)data; - - ale->flag= achan->flag; - - if (achan->ipo) { - ale->key_data= achan->ipo; - ale->datatype= ALE_IPO; - } - else { - ale->key_data= NULL; - ale->datatype= ALE_NONE; - } - } - break; - case ANIMTYPE_CONCHAN: - case ANIMTYPE_CONCHAN2: - { - bConstraintChannel *conchan= (bConstraintChannel *)data; - - ale->flag= conchan->flag; - - if (datatype == ANIMTYPE_CONCHAN2) { - /* CONCHAN2 is a hack so that constraint-channels keyframes can be edited */ - if (conchan->ipo) { - ale->key_data= conchan->ipo; - ale->datatype= ALE_IPO; - } - else { - ale->key_data= NULL; - ale->datatype= ALE_NONE; - } - } - else { - if ((conchan->ipo) && (conchan->ipo->curve.first)) { - /* we assume that constraint ipo blocks only have 1 curve: - * INFLUENCE, so we pretend that a constraint channel is - * really just a Ipo-Curve channel instead. - */ - ale->key_data= conchan->ipo->curve.first; - ale->datatype= ALE_ICU; - } - else { - ale->key_data= NULL; - ale->datatype= ALE_NONE; - } - } - } - break; - case ANIMTYPE_ICU: + case ANIMTYPE_FCURVE: { - IpoCurve *icu= (IpoCurve *)data; + FCurve *fcu= (FCurve *)data; - ale->flag= icu->flag; - - ale->key_data= icu; - ale->datatype= ALE_ICU; - } - break; - case ANIMTYPE_FILLIPO: - case ANIMTYPE_FILLCON: - { - bActionChannel *achan= (bActionChannel *)data; - - if (datatype == ANIMTYPE_FILLIPO) - ale->flag= FILTER_IPO_ACHAN(achan); - else - ale->flag= FILTER_CON_ACHAN(achan); - - ale->key_data= NULL; - ale->datatype= ALE_NONE; - } - break; - case ANIMTYPE_IPO: - { - ale->flag= 0; + ale->flag= fcu->flag; - ale->key_data= data; - ale->datatype= ALE_IPO; + ale->key_data= fcu; + ale->datatype= ALE_FCURVE; } break; @@ -512,21 +429,23 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s /* ----------------------------------------- */ -// FIXME: use this... -static int animdata_filter_ipocurves (ListBase *anim_data, Ipo *ipo, int filter_mode, void *owner, short ownertype, ID *owner_id) + +static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id) { bAnimListElem *ale = NULL; - IpoCurve *icu; + FCurve *fcu; int items = 0; - /* loop over ipo curves - assume that the caller of this has already checked that these should be included */ - for (icu= ipo->curve.first; icu; icu= icu->next) { + /* loop over F-Curves - assume that the caller of this has already checked that these should be included + * NOTE: we need to check if the F-Curves belong to the same group, as this gets called for groups too... + */ + for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) { /* only work with this channel and its subchannels if it is editable */ - if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_ICU(icu)) { - /* only include this curve if selected or we are including all IPO-curves */ - if (!(filter_mode & ANIMFILTER_SEL) || (filter_mode & ANIMFILTER_ONLYFCU) || (SEL_ICU(icu))) { + if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) { + /* only include this curve if selected */ + if (!(filter_mode & ANIMFILTER_SEL) || (SEL_FCU(fcu))) { /* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */ - ale= make_new_animlistelem(icu, ANIMTYPE_ICU, owner, ownertype); + ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, fcu, ANIMTYPE_FCURVE); if (ale) { /* ID will only be Object if data to write to directly belongs there, otherwise, another pointer will be used */ @@ -542,127 +461,19 @@ static int animdata_filter_ipocurves (ListBase *anim_data, Ipo *ipo, int filter_ return items; } -static int animdata_filter_actionchannel (ListBase *anim_data, bActionChannel *achan, int filter_mode, void *owner, short ownertype) -{ - bAnimListElem *ale = NULL; - bConstraintChannel *conchan; - short owned= (owner && ownertype)? 1 : 0; - int items = 0; - - /* only work with this channel and its subchannels if it is visible */ - if (!(filter_mode & ANIMFILTER_VISIBLE) || VISIBLE_ACHAN(achan)) { - /* only work with this channel and its subchannels if it is editable */ - if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_ACHAN(achan)) { - /* check if this achan should only be included if it is selected */ - if (!(filter_mode & ANIMFILTER_SEL) || SEL_ACHAN(achan)) { - /* are we only interested in the ipo-curves? */ - if ((filter_mode & ANIMFILTER_ONLYFCU)==0) { - ale= make_new_animlistelem(achan, ANIMTYPE_ACHAN, achan, ANIMTYPE_ACHAN); - - if (ale) { - if (owned) ale->id= owner; - BLI_addtail(anim_data, ale); - items++; - } - } - } - else { - /* for insert key... this check could be improved */ - //return; // FIXME... - } - - /* check if expanded - if not, continue on to next animion channel */ - if (EXPANDED_ACHAN(achan) == 0 && (filter_mode & ANIMFILTER_ONLYFCU)==0) { - /* only exit if we don't need to include constraint channels for group-channel keyframes */ - if ( !(filter_mode & ANIMFILTER_IPOKEYS) || (achan->grp == NULL) || (EXPANDED_AGRP(achan->grp)==0) ) - return items; - } - - /* ipo channels */ - if ((achan->ipo) && (filter_mode & ANIMFILTER_IPOKEYS)==0) { - /* include ipo-expand widget? */ - if ((filter_mode & ANIMFILTER_CHANNELS) && (filter_mode & ANIMFILTER_ONLYFCU)==0) { - ale= make_new_animlistelem(achan, ANIMTYPE_FILLIPO, achan, ANIMTYPE_ACHAN); - - if (ale) { - if (owned) ale->id= owner; - BLI_addtail(anim_data, ale); - items++; - } - } - - /* add ipo-curve channels? */ - if (FILTER_IPO_ACHAN(achan) || (filter_mode & ANIMFILTER_ONLYFCU)) { - /* loop through ipo-curve channels, adding them */ - items += animdata_filter_ipocurves(anim_data, achan->ipo, filter_mode, achan, ANIMTYPE_ACHAN, (owned)?(owner):(NULL)); - } - } - - /* constraint channels */ - if (achan->constraintChannels.first) { - /* include constraint-expand widget? */ - if ( (filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_ONLYFCU) - && !(filter_mode & ANIMFILTER_IPOKEYS) ) - { - ale= make_new_animlistelem(achan, ANIMTYPE_FILLCON, achan, ANIMTYPE_ACHAN); - - if (ale) { - if (owned) ale->id= owner; - BLI_addtail(anim_data, ale); - items++; - } - } - - /* add constraint channels? */ - if (FILTER_CON_ACHAN(achan) || (filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) { - /* loop through constraint channels, checking and adding them */ - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) { - /* only work with this channel and its subchannels if it is editable */ - if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_CONCHAN(conchan)) { - /* check if this conchan should only be included if it is selected */ - if (!(filter_mode & ANIMFILTER_SEL) || SEL_CONCHAN(conchan)) { - if (filter_mode & ANIMFILTER_IPOKEYS) { - ale= make_new_animlistelem(conchan, ANIMTYPE_CONCHAN2, achan, ANIMTYPE_ACHAN); - - if (ale) { - if (owned) ale->id= owner; - BLI_addtail(anim_data, ale); - items++; - } - } - else { - ale= make_new_animlistelem(conchan, ANIMTYPE_CONCHAN, achan, ANIMTYPE_ACHAN); - - if (ale) { - if (owned) ale->id= owner; - BLI_addtail(anim_data, ale); - items++; - } - } - } - } - } - } - } - } - } - - /* return the number of items added to the list */ - return items; -} - static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter_mode, void *owner, short ownertype) { bAnimListElem *ale=NULL; bActionGroup *agrp; - bActionChannel *achan, *lastchan=NULL; + FCurve *lastchan=NULL; short owned= (owner && ownertype) ? 1 : 0; int items = 0; /* loop over groups */ + // XXX in future, we need to be prepared for nestled groups... for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* add this group as a channel first */ - if (!(filter_mode & ANIMFILTER_ONLYFCU) && !(filter_mode & ANIMFILTER_IPOKEYS)) { + if ((filter_mode & ANIMFILTER_CHANNELS) || !(filter_mode & ANIMFILTER_CURVESONLY)) { /* check if filtering by selection */ if ( !(filter_mode & ANIMFILTER_SEL) || SEL_AGRP(agrp) ) { ale= make_new_animlistelem(agrp, ANIMTYPE_GROUP, NULL, ANIMTYPE_NONE); @@ -685,19 +496,18 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter * - groups show a "summary" of keyframes beside their name which must accessable for tools which handle keyframes * - groups can be collapsed (and those tools which are only interested in channels rely on knowing that group is closed) * - * cases when we should include animion-channels and so-forth inside group: + * cases when we should include F-Curves inside group: * - we don't care about visibility * - group is expanded * - we're interested in keyframes, but not if they appear in selected channels */ if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || - ( ((filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) && - (!(filter_mode & ANIMFILTER_SEL) || (SEL_AGRP(agrp))) ) ) + ( (!(filter_mode & ANIMFILTER_SEL) || (SEL_AGRP(agrp))) && + (filter_mode & ANIMFILTER_CURVESONLY) ) ) { - if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) { - for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) { - items += animdata_filter_actionchannel(anim_data, achan, filter_mode, owner, ownertype); - } + if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) { + // XXX the 'owner' info here needs review... + items += animdata_filter_fcurves(anim_data, agrp->channels.first, agrp, filter_mode, ((owned)?owner:NULL)); /* remove group from filtered list if last element is group * (i.e. only if group had channels, which were all hidden) @@ -714,11 +524,10 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter } } - /* loop over un-grouped animion channels (only if we're not only considering those channels in the animive group) */ + /* loop over un-grouped F-Curves (only if we're not only considering those channels in the animive group) */ if (!(filter_mode & ANIMFILTER_ACTGROUPED)) { - for (achan=(lastchan)?(lastchan->next):(act->chanbase.first); achan; achan=achan->next) { - items += animdata_filter_actionchannel(anim_data, achan, filter_mode, owner, ownertype); - } + // XXX the 'owner' info here needs review... + items += animdata_filter_fcurves(anim_data, (lastchan)?(lastchan->next):(act->curves.first), NULL, filter_mode, ((owned)?owner:NULL)); } /* return the number of items added to the list */ @@ -729,12 +538,12 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m { bAnimListElem *ale; KeyBlock *kb; - IpoCurve *icu; + //FCurve *fcu; short owned= (owner && ownertype)? 1 : 0; int i, items=0; /* are we filtering for display or editing */ - if (filter_mode & ANIMFILTER_FORDRAWING) { + if (filter_mode & ANIMFILTER_CHANNELS) { /* for display - loop over shapekeys, adding ipo-curve references where needed */ kb= key->block.first; @@ -750,6 +559,7 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m ale->datatype= ALE_NONE; ale->index = i; +#if 0 // XXX fixme... old system if (key->ipo) { for (icu= key->ipo->curve.first; icu; icu=icu->next) { if (icu->adrcode == i) { @@ -759,6 +569,7 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m } } } +#endif // XXX fixme... old system if (owned) ale->id= owner; @@ -767,6 +578,7 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m } } else { +#if 0 // XXX fixme... old system /* loop over ipo curves if present - for editing */ if (key->ipo) { if (filter_mode & ANIMFILTER_IPOKEYS) { @@ -781,6 +593,7 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m items += animdata_filter_ipocurves(anim_data, key->ipo, filter_mode, key, ANIMTYPE_SHAPEKEY, (owned)?(owner):(NULL)); } } +#endif // XXX fixme... old system } /* return the number of items added to the list */ @@ -798,7 +611,6 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter int items = 0; /* check if filtering types are appropriate */ - if ( !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU|ANIMFILTER_ACTGROUPED)) ) { /* special hack for fullscreen area (which must be this one then): * - we use the curarea->full as screen to get spaces from, since the @@ -817,7 +629,7 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter if (gpd == NULL) continue; /* add gpd as channel too (if for drawing, and it has layers) */ - if ((filter_mode & ANIMFILTER_FORDRAWING) && (gpd->layers.first)) { + if ((filter_mode & ANIMFILTER_CHANNELS) && (gpd->layers.first)) { /* add to list */ ale= make_new_animlistelem(gpd, ANIMTYPE_GPDATABLOCK, sa, ANIMTYPE_SPECIALDATA); if (ale) { @@ -852,6 +664,7 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter } #endif +#if 0 // XXX old anim sys static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode) { bAnimListElem *ale=NULL; @@ -982,17 +795,18 @@ static int animdata_filter_dopesheet_curve (ListBase *anim_data, bDopeSheet *ads /* return the number of items added to the list */ return items; } +#endif // XXX old anim sys static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode) { bAnimListElem *ale=NULL; Scene *sce= (Scene *)ads->source; Object *ob= base->object; - Key *key= ob_get_key(ob); +// Key *key= ob_get_key(ob); int items = 0; /* add this object as a channel first */ - if (!(filter_mode & ANIMFILTER_ONLYFCU) && !(filter_mode & ANIMFILTER_IPOKEYS)) { + if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) { /* check if filtering by selection */ if ( !(filter_mode & ANIMFILTER_SEL) || ((base->flag & SELECT) || (base == sce->basact)) ) { ale= make_new_animlistelem(base, ANIMTYPE_OBJECT, NULL, ANIMTYPE_NONE); @@ -1004,33 +818,16 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B } /* if collapsed, don't go any further (unless adding keyframes only) */ - if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU)) ) + if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) ) return items; - /* IPO? */ - if ((ob->ipo) && !(ads->filterflag & ADS_FILTER_NOIPOS)) { - /* include ipo-expand widget? */ - if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) { - ale= make_new_animlistelem(ob, ANIMTYPE_FILLIPOD, base, ANIMTYPE_OBJECT); - if (ale) { - BLI_addtail(anim_data, ale); - items++; - } - } - - /* add ipo-curve channels? */ - if ( (FILTER_IPO_OBJC(ob) || (filter_mode & ANIMFILTER_ONLYFCU)) && - !(filter_mode & ANIMFILTER_IPOKEYS) ) - { - items += animdata_filter_ipocurves(anim_data, ob->ipo, filter_mode, base, ANIMTYPE_OBJECT, NULL); // err... why not set ob? - } - } - /* Action? */ - if ((ob->action) && !(ads->filterflag & ADS_FILTER_NOACTS)) { - /* include animion-expand widget? */ - if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU))) { - ale= make_new_animlistelem(ob->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT); + if (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/) { + AnimData *adt= ob->adt; + + /* include action-expand widget? */ + if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_CURVESONLY))) { + ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT); if (ale) { ale->id= (ID *)ob; // err.... is this a good idea? BLI_addtail(anim_data, ale); @@ -1038,13 +835,14 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B } } - /* add ipo-curve channels? */ - if (EXPANDED_ACTC(ob->action) || !(filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_FORDRAWING))) { + /* add F-Curve channels? */ + if (EXPANDED_ACTC(adt->action) || !(filter_mode & ANIMFILTER_CHANNELS)) { // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?) - items += animdata_filter_action(anim_data, ob->action, filter_mode, ob, ANIMTYPE_OBJECT); + items += animdata_filter_action(anim_data, adt->action, filter_mode, ob, ANIMTYPE_OBJECT); } } +#if 0 // XXX fixme... /* ShapeKeys? */ if ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) { /* include shapekey-expand widget? */ @@ -1090,51 +888,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B } break; } - - /* Constraint Channels? */ - if ((ob->constraintChannels.first) && !(ads->filterflag & ADS_FILTER_NOCONSTRAINTS)) { - bConstraintChannel *conchan; - - /* include constraint-expand widget? */ - if ( (filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_ONLYFCU) - && !(filter_mode & ANIMFILTER_IPOKEYS) ) - { - ale= make_new_animlistelem(ob, ANIMTYPE_FILLCOND, base, ANIMTYPE_OBJECT); - if (ale) { - BLI_addtail(anim_data, ale); - items++; - } - } - - /* add constraint channels? */ - if (FILTER_CON_OBJC(ob) || (filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) { - /* loop through constraint channels, checking and adding them */ - for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next) { - /* only work with this channel and its subchannels if it is editable */ - if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_CONCHAN(conchan)) { - /* check if this conchan should only be included if it is selected */ - if (!(filter_mode & ANIMFILTER_SEL) || SEL_CONCHAN(conchan)) { - if (filter_mode & ANIMFILTER_IPOKEYS) { - ale= make_new_animlistelem(conchan, ANIMTYPE_CONCHAN2, base, ANIMTYPE_OBJECT); - if (ale) { - ale->id= (ID *)ob; - BLI_addtail(anim_data, ale); - items++; - } - } - else { - ale= make_new_animlistelem(conchan, ANIMTYPE_CONCHAN, base, ANIMTYPE_OBJECT); - if (ale) { - ale->id= (ID *)ob; - BLI_addtail(anim_data, ale); - items++; - } - } - } - } - } - } - } +#endif // XXX fixme... /* return the number of items added to the list */ return items; @@ -1159,7 +913,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int if (base->object) { Object *ob= base->object; Key *key= ob_get_key(ob); - short ipoOk, actOk, constsOk, keyOk, dataOk; + short actOk, keyOk, dataOk; /* firstly, check if object can be included, by the following fanimors: * - if only visible, must check for layer and also viewport visibility @@ -1192,28 +946,26 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int } /* check filters for datatypes */ - ipoOk= ((ob->ipo) && !(ads->filterflag & ADS_FILTER_NOIPOS)); - actOk= ((ob->action) && !(ads->filterflag & ADS_FILTER_NOACTS)); - constsOk= ((ob->constraintChannels.first) && !(ads->filterflag & ADS_FILTER_NOCONSTRAINTS)); + actOk= (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/); keyOk= ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)); switch (ob->type) { case OB_CAMERA: /* ------- Camera ------------ */ { Camera *ca= (Camera *)ob->data; - dataOk= ((ca->ipo) && !(ads->filterflag & ADS_FILTER_NOCAM)); + dataOk= (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM)); } break; case OB_LAMP: /* ---------- Lamp ----------- */ { Lamp *la= (Lamp *)ob->data; - dataOk= ((la->ipo) && !(ads->filterflag & ADS_FILTER_NOLAM)); + dataOk= (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM)); } break; case OB_CURVE: /* -------- Curve ---------- */ { Curve *cu= (Curve *)ob->data; - dataOk= ((cu->ipo) && !(ads->filterflag & ADS_FILTER_NOCUR)); + dataOk= (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR)); } break; default: /* --- other --- */ @@ -1222,33 +974,31 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int } /* check if all bad (i.e. nothing to show) */ - if (!ipoOk && !actOk && !constsOk && !keyOk && !dataOk) + if (!actOk && !keyOk && !dataOk) continue; } else { /* check data-types */ - ipoOk= (ob->ipo != NULL); - actOk= (ob->action != NULL); - constsOk= (ob->constraintChannels.first != NULL); + actOk= ANIMDATA_HAS_KEYS(ob); keyOk= (key != NULL); switch (ob->type) { case OB_CAMERA: /* ------- Camera ------------ */ { Camera *ca= (Camera *)ob->data; - dataOk= (ca->ipo != NULL); + dataOk= ANIMDATA_HAS_KEYS(ca); } break; case OB_LAMP: /* ---------- Lamp ----------- */ { Lamp *la= (Lamp *)ob->data; - dataOk= (la->ipo != NULL); + dataOk= ANIMDATA_HAS_KEYS(la); } break; case OB_CURVE: /* -------- Curve ---------- */ { Curve *cu= (Curve *)ob->data; - dataOk= (cu->ipo != NULL); + dataOk= ANIMDATA_HAS_KEYS(cu); } break; default: /* --- other --- */ @@ -1257,7 +1007,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int } /* check if all bad (i.e. nothing to show) */ - if (!ipoOk && !actOk && !constsOk && !keyOk && !dataOk) + if (!actOk && !keyOk && !dataOk) continue; } @@ -1317,17 +1067,6 @@ int ANIM_animdata_filter (ListBase *anim_data, int filter_mode, void *data, shor items--; BLI_freelinkN(anim_data, ale); } - - if (filter_mode & ANIMFILTER_IPOKEYS) { - if (ale->datatype != ALE_IPO) { - items--; - BLI_freelinkN(anim_data, ale); - } - else if (ale->key_data == NULL) { - items--; - BLI_freelinkN(anim_data, ale); - } - } } } diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index efe4f50c5e5..af66c0ea630 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -46,6 +46,7 @@ /* Types --------------------------------------------------------------- */ #include "DNA_listBase.h" +#include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" @@ -65,7 +66,7 @@ #include "BKE_action.h" #include "BKE_depsgraph.h" -#include "BKE_ipo.h" +#include "BKE_fcurve.h" #include "BKE_key.h" #include "BKE_material.h" #include "BKE_object.h" @@ -90,29 +91,6 @@ #include "ED_screen.h" #include "ED_space_api.h" - -#if 0 // XXX old includes for reference only - #include "BIF_editaction.h" - #include "BIF_editkey.h" - #include "BIF_editnla.h" - #include "BIF_drawgpencil.h" - #include "BIF_keyframing.h" - #include "BIF_language.h" - #include "BIF_space.h" - - #include "BDR_editcurve.h" - #include "BDR_gpencil.h" - - #include "BSE_drawnla.h" - #include "BSE_drawipo.h" - #include "BSE_drawview.h" - #include "BSE_editaction_types.h" - #include "BSE_editipo.h" - #include "BSE_headerbuttons.h" - #include "BSE_time.h" - #include "BSE_view.h" -#endif // XXX old defines for reference only - /* *************************** Keyframe Drawing *************************** */ static void add_bezt_to_keycolumnslist(ListBase *keys, BezTriple *bezt) @@ -155,7 +133,7 @@ static void add_bezt_to_keycolumnslist(ListBase *keys, BezTriple *bezt) akn->sel = 0; } -static void add_bezt_to_keyblockslist(ListBase *blocks, IpoCurve *icu, int index) +static void add_bezt_to_keyblockslist(ListBase *blocks, FCurve *fcu, int index) { /* The equivilant of add_to_cfra_elem except this version * makes ActKeyBlocks - one of the two datatypes required @@ -167,10 +145,10 @@ static void add_bezt_to_keyblockslist(ListBase *blocks, IpoCurve *icu, int index int v; /* get beztriples */ - beztn= (icu->bezt + index); + beztn= (fcu->bezt + index); /* we need to go through all beztriples, as they may not be in order (i.e. during transform) */ - for (v=0, bezt=icu->bezt; vtotvert; v++, bezt++) { + for (v=0, bezt=fcu->bezt; v < fcu->totvert; v++, bezt++) { /* skip if beztriple is current */ if (v != index) { /* check if beztriple is immediately before */ @@ -365,24 +343,12 @@ void draw_object_channel(gla2DDrawInfo *di, ActKeysInc *aki, Object *ob, float y BLI_freelistN(&blocks); } -void draw_ipo_channel(gla2DDrawInfo *di, ActKeysInc *aki, Ipo *ipo, float ypos) +void draw_fcurve_channel(gla2DDrawInfo *di, ActKeysInc *aki, FCurve *fcu, float ypos) { ListBase keys = {0, 0}; ListBase blocks = {0, 0}; - ipo_to_keylist(ipo, &keys, &blocks, aki); - draw_keylist(di, &keys, &blocks, ypos); - - BLI_freelistN(&keys); - BLI_freelistN(&blocks); -} - -void draw_icu_channel(gla2DDrawInfo *di, ActKeysInc *aki, IpoCurve *icu, float ypos) -{ - ListBase keys = {0, 0}; - ListBase blocks = {0, 0}; - - icu_to_keylist(icu, &keys, &blocks, aki); + fcurve_to_keylist(fcu, &keys, &blocks, aki); draw_keylist(di, &keys, &blocks, ypos); BLI_freelistN(&keys); @@ -426,7 +392,6 @@ void draw_gpl_channel(gla2DDrawInfo *di, ActKeysInc *aki, bGPDlayer *gpl, float void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks, ActKeysInc *aki) { - bConstraintChannel *conchan; Key *key= ob_get_key(ob); if (ob) { @@ -441,14 +406,11 @@ void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks, ActKeysInc *aki else filterflag= 0; - /* Add object keyframes */ - if ((ob->ipo) && !(filterflag & ADS_FILTER_NOIPOS)) - ipo_to_keylist(ob->ipo, keys, blocks, aki); - /* Add action keyframes */ - if ((ob->action) && !(filterflag & ADS_FILTER_NOACTS)) - action_nlascaled_to_keylist(ob, ob->action, keys, blocks, aki); + if ((ob->adt && ob->adt->action) /*&& !(filterflag & ADS_FILTER_NOACTS)*/) + action_nlascaled_to_keylist(ob, ob->adt->action, keys, blocks, aki); +#if 0 // XXX old animation system /* Add shapekey keyframes (only if dopesheet allows, if it is available) */ if ((key && key->ipo) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) ipo_to_keylist(key->ipo, keys, blocks, aki); @@ -489,14 +451,7 @@ void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks, ActKeysInc *aki } break; } - - /* Add constraint keyframes */ - if (!(filterflag & ADS_FILTER_NOCONSTRAINTS)) { - for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next) { - if (conchan->ipo) - ipo_to_keylist(conchan->ipo, keys, blocks, aki); - } - } +#endif // XXX old animation system } } @@ -524,22 +479,22 @@ static short bezt_in_aki_range (ActKeysInc *aki, BezTriple *bezt) return 1; } -void icu_to_keylist(IpoCurve *icu, ListBase *keys, ListBase *blocks, ActKeysInc *aki) +void fcurve_to_keylist(FCurve *fcu, ListBase *keys, ListBase *blocks, ActKeysInc *aki) { BezTriple *bezt; ActKeyColumn *ak, *ak2; ActKeyBlock *ab, *ab2; int v; - if (icu && icu->totvert) { + if (fcu && fcu->totvert) { /* loop through beztriples, making ActKeys and ActKeyBlocks */ - bezt= icu->bezt; + bezt= fcu->bezt; - for (v=0; vtotvert; v++, bezt++) { + for (v=0; v < fcu->totvert; v++, bezt++) { /* only if keyframe is in range (optimisation) */ if (bezt_in_aki_range(aki, bezt)) { add_bezt_to_keycolumnslist(keys, bezt); - if (blocks) add_bezt_to_keyblockslist(blocks, icu, v); + if (blocks) add_bezt_to_keyblockslist(blocks, fcu, v); } } @@ -579,64 +534,33 @@ void icu_to_keylist(IpoCurve *icu, ListBase *keys, ListBase *blocks, ActKeysInc } } -void ipo_to_keylist(Ipo *ipo, ListBase *keys, ListBase *blocks, ActKeysInc *aki) -{ - IpoCurve *icu; - - if (ipo) { - for (icu= ipo->curve.first; icu; icu= icu->next) - icu_to_keylist(icu, keys, blocks, aki); - } -} - void agroup_to_keylist(bActionGroup *agrp, ListBase *keys, ListBase *blocks, ActKeysInc *aki) { - bActionChannel *achan; - bConstraintChannel *conchan; + FCurve *fcu; if (agrp) { - /* loop through action channels */ - for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) { - if (VISIBLE_ACHAN(achan)) { - /* firstly, add keys from action channel's ipo block */ - if (achan->ipo) - ipo_to_keylist(achan->ipo, keys, blocks, aki); - - /* then, add keys from constraint channels */ - for (conchan= achan->constraintChannels.first; conchan; conchan= conchan->next) { - if (conchan->ipo) - ipo_to_keylist(conchan->ipo, keys, blocks, aki); - } - } + /* loop through F-Curves */ + for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) { + fcurve_to_keylist(fcu, keys, blocks, aki); } } } void action_to_keylist(bAction *act, ListBase *keys, ListBase *blocks, ActKeysInc *aki) { - bActionChannel *achan; - bConstraintChannel *conchan; + FCurve *fcu; if (act) { - /* loop through action channels */ - for (achan= act->chanbase.first; achan; achan= achan->next) { - /* firstly, add keys from action channel's ipo block */ - if (achan->ipo) - ipo_to_keylist(achan->ipo, keys, blocks, aki); - - /* then, add keys from constraint channels */ - for (conchan= achan->constraintChannels.first; conchan; conchan= conchan->next) { - if (conchan->ipo) - ipo_to_keylist(conchan->ipo, keys, blocks, aki); - } + /* loop through F-Curves */ + for (fcu= act->curves.first; fcu; fcu= fcu->next) { + fcurve_to_keylist(fcu, keys, blocks, aki); } } } void action_nlascaled_to_keylist(Object *ob, bAction *act, ListBase *keys, ListBase *blocks, ActKeysInc *aki) { - bActionChannel *achan; - bConstraintChannel *conchan; + FCurve *fcu; Object *oldob= NULL; /* although apply and clearing NLA-scaling pre-post creating keylist does impact on performance, @@ -650,27 +574,13 @@ void action_nlascaled_to_keylist(Object *ob, bAction *act, ListBase *keys, ListB aki->ob= ob; } - /* loop through action channels */ - for (achan= act->chanbase.first; achan; achan= achan->next) { - /* firstly, add keys from action channel's ipo block - * - scaling correction only does times for center-points, so should be faster - */ - if (achan->ipo) { - ANIM_nla_mapping_apply_ipo(ob, achan->ipo, 0, 1); - ipo_to_keylist(achan->ipo, keys, blocks, aki); - ANIM_nla_mapping_apply_ipo(ob, achan->ipo, 1, 1); - } - - /* then, add keys from constraint channels - * - scaling correction only does times for center-points, so should be faster - */ - for (conchan= achan->constraintChannels.first; conchan; conchan= conchan->next) { - if (conchan->ipo) { - ANIM_nla_mapping_apply_ipo(ob, conchan->ipo, 0, 1); - ipo_to_keylist(conchan->ipo, keys, blocks, aki); - ANIM_nla_mapping_apply_ipo(ob, conchan->ipo, 1, 1); - } - } + /* loop through F-Curves + * - scaling correction only does times for center-points, so should be faster + */ + for (fcu= act->curves.first; fcu; fcu= fcu->next) { + ANIM_nla_mapping_apply_fcurve(ob, fcu, 0, 1); + fcurve_to_keylist(fcu, keys, blocks, aki); + ANIM_nla_mapping_apply_fcurve(ob, fcu, 1, 1); } /* if 'aki' is provided, restore ob */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index b38cbde7410..5596e244aee 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -76,10 +76,10 @@ /* --------------------------- Base Functions ------------------------------------ */ -/* This function is used to loop over BezTriples in the given IpoCurve, applying a given - * operation on them, and optionally applies an IPO-curve validate function afterwards. +/* 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_icu_keys_bezier_loop(BeztEditData *bed, IpoCurve *icu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb) +short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb) { BezTriple *bezt; int b; @@ -90,7 +90,7 @@ short ANIM_icu_keys_bezier_loop(BeztEditData *bed, IpoCurve *icu, BeztEditFunc b * (this is should be more efficient than checking for it in every loop) */ if (bezt_ok) { - for (b=0, bezt=icu->bezt; b < icu->totvert; b++, bezt++) { + for (b=0, bezt=fcu->bezt; b < fcu->totvert; b++, bezt++) { /* Only operate on this BezTriple if it fullfills the criteria of the validation func */ if (bezt_ok(bed, bezt)) { /* Exit with return-code '1' if function returns positive @@ -101,7 +101,7 @@ short ANIM_icu_keys_bezier_loop(BeztEditData *bed, IpoCurve *icu, BeztEditFunc b } } else { - for (b=0, bezt=icu->bezt; b < icu->totvert; b++, bezt++) { + for (b=0, bezt=fcu->bezt; b < fcu->totvert; b++, bezt++) { /* Exit with return-code '1' if function returns positive * This is useful if finding if some BezTriple satisfies a condition. */ @@ -110,68 +110,38 @@ short ANIM_icu_keys_bezier_loop(BeztEditData *bed, IpoCurve *icu, BeztEditFunc b } } - /* if ipocurve_function has been specified then execute it */ - if (icu_cb) - icu_cb(icu); + /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */ + if (fcu_cb) + fcu_cb(fcu); /* done */ return 0; } -/* This function is used to loop over the IPO curves in the given IPO (and subsequently the keyframes in them) */ -short ANIM_ipo_keys_bezier_loop(BeztEditData *bed, Ipo *ipo, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb) -{ - IpoCurve *icu; - - /* Sanity check */ - if (ipo == NULL) - return 0; - - /* Loop through each curve in the Ipo */ - for (icu= ipo->curve.first; icu; icu=icu->next) { - if (ANIM_icu_keys_bezier_loop(bed, icu, bezt_ok, bezt_cb, icu_cb)) - return 1; - } - - return 0; -} - /* -------------------------------- Further Abstracted ----------------------------- */ /* 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, IcuEditFunc icu_cb) +static short agrp_keys_bezier_loop(BeztEditData *bed, bActionGroup *agrp, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb) { - bActionChannel *achan; - bConstraintChannel *conchan; + FCurve *fcu; /* only iterate over the action-channels and their sub-channels that are in this group */ - for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) { - if (ANIM_ipo_keys_bezier_loop(bed, achan->ipo, bezt_ok, bezt_cb, icu_cb)) + 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; - - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) { - if (ANIM_ipo_keys_bezier_loop(bed, conchan->ipo, bezt_ok, bezt_cb, icu_cb)) - return 1; - } } return 0; } -/* This function is used to loop over the keyframe data in an Action Group */ -static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb) +/* 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) { - bActionChannel *achan; - bConstraintChannel *conchan; + FCurve *fcu; - for (achan= act->chanbase.first; achan; achan= achan->next) { - if (ANIM_ipo_keys_bezier_loop(bed, achan->ipo, bezt_ok, bezt_cb, icu_cb)) - return 1; - - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) { - if (ANIM_ipo_keys_bezier_loop(bed, conchan->ipo, bezt_ok, bezt_cb, icu_cb)) - return 1; - } + /* 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); } return 0; @@ -181,7 +151,7 @@ static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc /* 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, IcuEditFunc icu_cb) +short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb) { /* sanity checks */ if (ale == NULL) @@ -190,18 +160,16 @@ short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, B /* method to use depends on the type of keyframe data */ switch (ale->datatype) { /* direct keyframe data (these loops are exposed) */ - case ALE_ICU: /* ipo-curve */ - return ANIM_icu_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, icu_cb); - case ALE_IPO: /* ipo */ - return ANIM_ipo_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, icu_cb); + case ALE_FCURVE: /* F-Curve */ + return ANIM_fcurve_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_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_keys_bezier_loop(bed, (bActionGroup *)ale->data, bezt_ok, bezt_cb, icu_cb); + 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, icu_cb); + return act_keys_bezier_loop(bed, (bAction *)ale->data, bezt_ok, bezt_cb, fcu_cb); } return 0; @@ -219,7 +187,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) int filter; /* filter animation data */ - filter= ANIMFILTER_ONLYFCU; + filter= ANIMFILTER_CURVESONLY; ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* loop over ipo-curves that are likely to have been edited, and check them */ @@ -489,19 +457,6 @@ BeztEditFunc ANIM_editkeyframes_handles(short code) /* ------- */ -/* IPO-curve sanity callback - the name of this is a bit unwieldy, by is best to keep this in style... */ -// was called set_ipocurve_mixed() -void ANIM_editkeyframes_ipocurve_ipotype(IpoCurve *icu) -{ - /* Sets the type of the IPO curve to mixed, as some (selected) - * keyframes were set to other interpolation types - */ - icu->ipo= IPO_MIXED; - - /* recalculate handles, as some changes may have occurred */ - //calchandles_ipocurve(icu); // XXX -} - static short set_bezt_constant(BeztEditData *bed, BezTriple *bezt) { if (bezt->f2 & SELECT) @@ -537,16 +492,6 @@ BeztEditFunc ANIM_editkeyframes_ipo(short code) } } -// XXX will we keep this? -void setexprap_ipoloop(Ipo *ipo, short code) -{ - IpoCurve *icu; - - /* Loop through each curve in the Ipo */ - for (icu=ipo->curve.first; icu; icu=icu->next) - icu->extrap= code; -} - /* ******************************************* */ /* Selection */ @@ -593,73 +538,3 @@ BeztEditFunc ANIM_editkeyframes_select(short selectmode) return select_bezier_add; } } - - -short is_ipo_key_selected(Ipo *ipo) -{ - IpoCurve *icu; - BezTriple *bezt; - int i; - - if (ipo == NULL) - return 0; - - for (icu=ipo->curve.first; icu; icu=icu->next) { - for (i=0, bezt=icu->bezt; itotvert; i++, bezt++) { - if (BEZSELECTED(bezt)) - return 1; - } - } - - return 0; -} - -// XXX although this is still needed, it should be removed! -void set_ipo_key_selection(Ipo *ipo, short sel) -{ - IpoCurve *icu; - BezTriple *bezt; - int i; - - if (ipo == NULL) - return; - - for (icu=ipo->curve.first; icu; icu=icu->next) { - for (i=0, bezt=icu->bezt; itotvert; i++, bezt++) { - if (sel == 2) { - BEZ_INVSEL(bezt); - } - else if (sel == 1) { - BEZ_SEL(bezt); - } - else { - BEZ_DESEL(bezt); - } - } - } -} - -// XXX port this over to the new system! -// err... this is this still used? -int fullselect_ipo_keys(Ipo *ipo) -{ - IpoCurve *icu; - int tvtot = 0; - int i; - - if (!ipo) - return tvtot; - - for (icu=ipo->curve.first; icu; icu=icu->next) { - for (i=0; itotvert; i++) { - if (icu->bezt[i].f2 & SELECT) { - tvtot+=3; - icu->bezt[i].f1 |= SELECT; - icu->bezt[i].f3 |= SELECT; - } - } - } - - return tvtot; -} - diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 4b58aa4a6c8..a334242b655 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -40,8 +40,8 @@ struct View2D; struct gla2DDrawInfo; struct Object; struct bActionGroup; -struct Ipo; -struct IpoCurve; +struct FCurve; +struct IpoCurve; // xxx /* ************************************************ */ /* ANIMATION CHANNEL FILTERING */ @@ -74,7 +74,7 @@ typedef enum eAnimCont_Types { ANIMCONT_SHAPEKEY, /* shapekey (Key) */ ANIMCONT_GPENCIL, /* grease pencil (screen) */ ANIMCONT_DOPESHEET, /* dopesheet (bDopesheet) */ - ANIMCONT_IPO, /* single IPO (Ipo) */ + ANIMCONT_IPO, /* single IPO (Ipo) */ // XXX } eAnimCont_Types; /* --------------- Channels -------------------- */ @@ -109,13 +109,9 @@ typedef enum eAnim_ChannelType { ANIMTYPE_OBJECT, ANIMTYPE_GROUP, - - ANIMTYPE_FILLIPO, - ANIMTYPE_FILLCON, + ANIMTYPE_FCURVE, ANIMTYPE_FILLACTD, - ANIMTYPE_FILLIPOD, - ANIMTYPE_FILLCOND, ANIMTYPE_FILLMATD, ANIMTYPE_DSMAT, @@ -124,13 +120,8 @@ typedef enum eAnim_ChannelType { ANIMTYPE_DSCUR, ANIMTYPE_DSSKEY, - ANIMTYPE_ACHAN, - ANIMTYPE_CONCHAN, - ANIMTYPE_CONCHAN2, - ANIMTYPE_ICU, - ANIMTYPE_IPO, + ANIMTYPE_SHAPEKEY, // XXX probably can become depreceated??? - ANIMTYPE_SHAPEKEY, ANIMTYPE_GPDATABLOCK, ANIMTYPE_GPLAYER, } eAnim_ChannelType; @@ -138,8 +129,7 @@ typedef enum eAnim_ChannelType { /* types of keyframe data in bAnimListElem */ typedef enum eAnim_KeyType { ALE_NONE = 0, /* no keyframe data */ - ALE_IPO, /* IPO block */ - ALE_ICU, /* IPO-Curve block */ + ALE_FCURVE, /* F-Curve */ ALE_GPFRAME, /* Grease Pencil Frames */ // XXX the following are for summaries... should these be kept? @@ -156,23 +146,20 @@ typedef enum eAnimFilter_Flags { ANIMFILTER_VISIBLE = (1<<0), /* should channels be visible */ ANIMFILTER_SEL = (1<<1), /* should channels be selected */ ANIMFILTER_FOREDIT = (1<<2), /* does editable status matter */ - ANIMFILTER_CHANNELS = (1<<3), /* do we only care that it is a channel */ - ANIMFILTER_IPOKEYS = (1<<4), /* only channels referencing ipo's */ - ANIMFILTER_ONLYFCU = (1<<5), /* only reference ipo-curves */ - ANIMFILTER_FORDRAWING = (1<<6), /* make list for interface drawing */ - ANIMFILTER_ACTGROUPED = (1<<7), /* belongs to the active actiongroup */ + ANIMFILTER_CURVESONLY = (1<<3), /* don't include summary-channels, etc. */ + ANIMFILTER_CHANNELS = (1<<4), /* make list for interface drawing */ + ANIMFILTER_ACTGROUPED = (1<<5), /* belongs to the active actiongroup */ } eAnimFilter_Flags; /* ---------- Flag Checking Macros ------------ */ +// xxx check on all of these flags again... /* Dopesheet only */ /* 'Object' channels */ #define SEL_OBJC(base) ((base->flag & SELECT)) #define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0) /* 'Sub-object' channels (flags stored in Object block) */ -#define FILTER_IPO_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWIPO)) -#define FILTER_CON_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWCONS)) #define FILTER_MAT_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWMATS)) /* 'Sub-object' channels (flags stored in Data block) */ #define FILTER_SKE_OBJD(key) ((key->flag & KEYBLOCK_DS_EXPAND)) @@ -181,31 +168,17 @@ typedef enum eAnimFilter_Flags { #define FILTER_CAM_OBJD(ca) ((ca->flag & CAM_DS_EXPAND)) #define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND)) /* 'Sub-object/Action' channels (flags stored in Action) */ - // XXX temp flags for things removed -#define ACTC_SELECTED 1 -#define ACTC_EXPANDED 2 - // XXX these need to be fixed -#define SEL_ACTC(actc) ((actc->flag & ACTC_SELECTED)) -#define EXPANDED_ACTC(actc) ((actc->flag & ACTC_EXPANDED)) +#define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED)) +#define EXPANDED_ACTC(actc) ((actc->flag & ACT_EXPANDED)) /* Actions (also used for Dopesheet) */ /* Action Channel Group */ #define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0) #define EXPANDED_AGRP(agrp) (agrp->flag & AGRP_EXPANDED) #define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE)) - /* Action Channel Settings */ -#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0) -#define EDITABLE_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && ((achan->flag & ACHAN_PROTECTED)==0)) -#define EXPANDED_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && (achan->flag & ACHAN_EXPANDED)) -#define SEL_ACHAN(achan) ((achan->flag & ACHAN_SELECTED) || (achan->flag & ACHAN_HILIGHTED)) -#define FILTER_IPO_ACHAN(achan) ((achan->flag & ACHAN_SHOWIPO)) -#define FILTER_CON_ACHAN(achan) ((achan->flag & ACHAN_SHOWCONS)) - /* Constraint Channel Settings */ -#define EDITABLE_CONCHAN(conchan) ((conchan->flag & CONSTRAINT_CHANNEL_PROTECTED)==0) -#define SEL_CONCHAN(conchan) (conchan->flag & CONSTRAINT_CHANNEL_SELECT) - /* IPO Curve Channels */ -#define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0) -#define SEL_ICU(icu) (icu->flag & IPO_SELECT) + /* F-Curve Channels */ +#define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED)==0) +#define SEL_FCU(fcu) (fcu->flag & (FCURVE_ACTIVE|FCURVE_SELECTED)) /* Grease Pencil only */ /* Grease Pencil datablock settings */ @@ -301,7 +274,7 @@ void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d); /* anim_ipo_utils.c */ int geticon_ipo_blocktype(short blocktype); -char *getname_ipocurve(struct IpoCurve *icu, struct Object *ob); +char *getname_ipocurve(struct IpoCurve *icu, struct Object *ob); // XXX unsigned int ipo_rainbow(int cur, int tot); @@ -316,8 +289,7 @@ struct Object *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale); void ANIM_nla_mapping_draw(struct gla2DDrawInfo *di, struct Object *ob, short restore); /* Apply/Unapply NLA mapping to all keyframes in the nominated IPO block */ -void ANIM_nla_mapping_apply_ipocurve(struct Object *ob, struct IpoCurve *icu, short restore, short only_keys); -void ANIM_nla_mapping_apply_ipo(struct Object *ob, struct Ipo *ipo, short restore, short only_keys); +void ANIM_nla_mapping_apply_fcurve(struct Object *ob, struct FCurve *fcu, short restore, short only_keys); /* ------------- xxx macros ----------------------- */ diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 7a9aeef5883..b9308b6d8a6 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -31,8 +31,7 @@ #define ED_KEYFRAMES_DRAW_H struct BezTriple; -struct Ipo; -struct IpoCurve; +struct FCurve; struct gla2DDrawInfo; struct bAction; struct bActionGroup; @@ -79,16 +78,14 @@ typedef struct ActKeysInc { /* ******************************* Methods ****************************** */ /* Channel Drawing */ -void draw_icu_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct IpoCurve *icu, float ypos); -void draw_ipo_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct Ipo *ipo, float ypos); +void draw_fcurve_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct FCurve *fcu, float ypos); void draw_agroup_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct bActionGroup *agrp, float ypos); void draw_action_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct bAction *act, float ypos); void draw_object_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct Object *ob, float ypos); void draw_gpl_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct bGPDlayer *gpl, float ypos); /* Keydata Generation */ -void icu_to_keylist(struct IpoCurve *icu, ListBase *keys, ListBase *blocks, ActKeysInc *aki); -void ipo_to_keylist(struct Ipo *ipo, ListBase *keys, ListBase *blocks, ActKeysInc *aki); +void fcurve_to_keylist(struct FCurve *fcu, ListBase *keys, ListBase *blocks, ActKeysInc *aki); void agroup_to_keylist(struct bActionGroup *agrp, ListBase *keys, ListBase *blocks, ActKeysInc *aki); void action_to_keylist(struct bAction *act, ListBase *keys, ListBase *blocks, ActKeysInc *aki); void action_nlascaled_to_keylist(struct Object *ob, struct bAction *act, ListBase *keys, ListBase *blocks, ActKeysInc *aki); diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 77d41ace857..cac32b18036 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -30,8 +30,6 @@ #define ED_KEYFRAMES_EDIT_H struct bAnimContext; -struct Ipo; -struct IpoCurve; struct FCurve; struct BezTriple; struct Scene; @@ -99,15 +97,14 @@ typedef struct BeztEditData { /* ------- Function Pointer Typedefs ---------------- */ /* callback function that refreshes the IPO curve after use */ -typedef void (*IcuEditFunc)(struct IpoCurve *icu); +typedef void (*FcuEditFunc)(struct FCurve *fcu); /* callback function that operates on the given BezTriple */ typedef short (*BeztEditFunc)(BeztEditData *bed, struct BezTriple *bezt); /* ---------------- Looping API --------------------- */ /* functions for looping over keyframes */ -short ANIM_icu_keys_bezier_loop(BeztEditData *bed, struct IpoCurve *icu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb); -short ANIM_ipo_keys_bezier_loop(BeztEditData *bed, struct Ipo *ipo, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, IcuEditFunc icu_cb); +short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, struct FCurve *Fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb); /* functions for making sure all keyframes are in good order */ void ANIM_editkeyframes_refresh(struct bAnimContext *ac); @@ -124,15 +121,11 @@ BeztEditFunc ANIM_editkeyframes_select(short mode); BeztEditFunc ANIM_editkeyframes_handles(short mode); BeztEditFunc ANIM_editkeyframes_ipo(short mode); -/* ---------- IpoCurve Callbacks ------------ */ - -void ANIM_editkeyframes_ipocurve_ipotype(struct IpoCurve *icu); - /* ************************************************ */ /* Destructive Editing API (keyframes_general.c) */ void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc); -void delete_ipo_keys(struct Ipo *ipo); +void delete_fcurve_keys(struct FCurve *fcu); void duplicate_ipo_keys(struct Ipo *ipo); void clean_fcurve(struct FCurve *fcu, float thresh); @@ -146,7 +139,6 @@ void smooth_fcurve(struct FCurve *fcu, short mode); short is_ipo_key_selected(struct Ipo *ipo); void set_ipo_key_selection(struct Ipo *ipo, short sel); -void setexprap_ipoloop(struct Ipo *ipo, short code); /* ************************************************ */ diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 0912edb7076..39a477f30fb 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -46,11 +46,11 @@ /* Types --------------------------------------------------------------- */ #include "DNA_listBase.h" +#include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" #include "DNA_curve_types.h" -#include "DNA_ipo_types.h" #include "DNA_object_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" @@ -65,7 +65,7 @@ #include "BKE_action.h" #include "BKE_depsgraph.h" -#include "BKE_ipo.h" +#include "BKE_fcurve.h" #include "BKE_key.h" #include "BKE_material.h" #include "BKE_object.h" @@ -408,7 +408,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) int items, height; /* build list of channels to draw */ - filter= (ANIMFILTER_FORDRAWING|ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); items= ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* Update max-extent of channels here (taking into account scrollers): @@ -484,40 +484,6 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) strcpy(name, "Action"); } break; - case ANIMTYPE_FILLIPOD: /* ipo (dopesheet) expand widget */ - { - Object *ob = (Object *)ale->data; - - group = 4; - indent = 1; - special = ICON_IPO; - - if (FILTER_IPO_OBJC(ob)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - //sel = SEL_OBJC(base); - strcpy(name, "IPO Curves"); - } - break; - case ANIMTYPE_FILLCOND: /* constraint channels (dopesheet) expand widget */ - { - Object *ob = (Object *)ale->data; - - group = 4; - indent = 1; - special = ICON_CONSTRAINT; - - if (FILTER_CON_OBJC(ob)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - //sel = SEL_OBJC(base); - strcpy(name, "Constraints"); - } - break; case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */ { Object *ob = (Object *)ale->data; @@ -647,83 +613,9 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) strcpy(name, agrp->name); } break; - case ANIMTYPE_ACHAN: /* action channel */ - { - bActionChannel *achan= (bActionChannel *)ale->data; - - group= (ale->grp) ? 1 : 0; - grp= ale->grp; - - indent = 0; - special = -1; - - offset= (ale->id) ? 21 : 0; - - if (EXPANDED_ACHAN(achan)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - if (EDITABLE_ACHAN(achan)) - protect = ICON_UNLOCKED; - else - protect = ICON_LOCKED; - - if (achan->ipo) { - if (achan->ipo->muteipo) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - sel = SEL_ACHAN(achan); - strcpy(name, achan->name); - } - break; - case ANIMTYPE_CONCHAN: /* constraint channel */ - { - bConstraintChannel *conchan = (bConstraintChannel *)ale->data; - - group= (ale->grp) ? 1 : 0; - grp= ale->grp; - - if (ale->id) { - if (ale->ownertype == ANIMTYPE_ACHAN) { - /* for constraint channels under Action in Dopesheet */ - indent= 2; - offset= 21; - } - else { - /* for constraint channels under Object in Dopesheet */ - indent= 2; - offset = 0; - } - } - else { - /* for normal constraint channels in Action Editor */ - indent= 2; - offset= 0; - } - - if (EDITABLE_CONCHAN(conchan)) - protect = ICON_UNLOCKED; - else - protect = ICON_LOCKED; - - if (conchan->ipo) { - if (conchan->ipo->muteipo) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - sel = SEL_CONCHAN(conchan); - strcpy(name, conchan->name); - } - break; - case ANIMTYPE_ICU: /* ipo-curve channel */ + case ANIMTYPE_FCURVE: /* F-Curve channel */ { - IpoCurve *icu = (IpoCurve *)ale->data; + FCurve *fcu = (FCurve *)ale->data; indent = 2; protect = -1; // for now, until this can be supported by others @@ -732,7 +624,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) grp= ale->grp; if (ale->id) { - if ((GS(ale->id->name)==ID_MA) || (ale->ownertype == ANIMTYPE_ACHAN)) + if (GS(ale->id->name) == ID_MA) offset= 21; else offset= 0; @@ -740,67 +632,23 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) else offset= 0; - if (icu->flag & IPO_MUTE) + if (fcu->flag & FCURVE_MUTED) mute = ICON_MUTE_IPO_ON; else mute = ICON_MUTE_IPO_OFF; - if (EDITABLE_ICU(icu)) + if (EDITABLE_FCU(fcu)) protect = ICON_UNLOCKED; else protect = ICON_LOCKED; - sel = SEL_ICU(icu); - if (saction->pin) - strcpy(name, getname_ipocurve(icu, NULL)); // xxx func to eventually eliminate - else - strcpy(name, getname_ipocurve(icu, ac->obact)); // xxx func to eventually eliminate - } - break; - case ANIMTYPE_FILLIPO: /* ipo expand widget */ - { - bActionChannel *achan = (bActionChannel *)ale->data; - - indent = 1; - special = geticon_ipo_blocktype(achan->ipo->blocktype); // xxx func to eventually eliminate - - group= (ale->grp) ? 1 : 0; - grp= ale->grp; - - offset= (ale->id) ? 21 : 0; - - if (FILTER_IPO_ACHAN(achan)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - sel = SEL_ACHAN(achan); - strcpy(name, "IPO Curves"); - } - break; - case ANIMTYPE_FILLCON: /* constraint expand widget */ - { - bActionChannel *achan = (bActionChannel *)ale->data; - - indent = 1; - special = ICON_CONSTRAINT; - - group= (ale->grp) ? 1 : 0; - grp= ale->grp; - - offset= (ale->id) ? 21 : 0; + sel = SEL_FCU(fcu); - if (FILTER_CON_ACHAN(achan)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - sel = SEL_ACHAN(achan); - strcpy(name, "Constraint"); + // for now, we just print the full path... this needs more work! + sprintf(name, "%s[%d]", fcu->rna_path, fcu->array_index); } break; - case ANIMTYPE_SHAPEKEY: /* shapekey channel */ { KeyBlock *kb = (KeyBlock *)ale->data; @@ -1138,7 +986,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) } /* build list of channels to draw */ - filter= (ANIMFILTER_FORDRAWING|ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS); items= ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* Update max-extent of channels here (taking into account scrollers): @@ -1185,22 +1033,10 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) sel = SEL_AGRP(agrp); } break; - case ANIMTYPE_ACHAN: - { - bActionChannel *achan = (bActionChannel *)ale->data; - sel = SEL_ACHAN(achan); - } - break; - case ANIMTYPE_CONCHAN: - { - bConstraintChannel *conchan = (bConstraintChannel *)ale->data; - sel = SEL_CONCHAN(conchan); - } - break; - case ANIMTYPE_ICU: + case ANIMTYPE_FCURVE: { - IpoCurve *icu = (IpoCurve *)ale->data; - sel = SEL_ICU(icu); + FCurve *fcu = (FCurve *)ale->data; + sel = SEL_FCU(fcu); } break; case ANIMTYPE_GPLAYER: @@ -1221,10 +1057,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) else glColor4ub(col1b[0], col1b[1], col1b[2], 0x22); } break; - - case ANIMTYPE_FILLIPOD: - case ANIMTYPE_FILLACTD: - case ANIMTYPE_FILLCOND: + case ANIMTYPE_DSSKEY: { if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45); @@ -1321,11 +1154,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) case ALE_GROUP: draw_agroup_channel(di, aki, ale->data, y); break; - case ALE_IPO: - draw_ipo_channel(di, aki, ale->key_data, y); - break; - case ALE_ICU: - draw_icu_channel(di, aki, ale->key_data, y); + case ALE_FCURVE: + draw_fcurve_channel(di, aki, ale->key_data, y); break; case ALE_GPFRAME: draw_gpl_channel(di, aki, ale->data, y); diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 87741d82a1a..6a7e7d7421e 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -97,7 +97,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max) int filter; /* get data to filter, from Action or Dopesheet */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ @@ -293,6 +293,7 @@ void free_actcopybuf () */ static short copy_action_keys (bAnimContext *ac) { +#if 0 // XXX old animation system ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; @@ -372,6 +373,7 @@ static short copy_action_keys (bAnimContext *ac) /* free temp memory */ BLI_freelistN(&anim_data); +#endif // XXX old animation system /* everything went fine */ return 0; @@ -379,6 +381,7 @@ static short copy_action_keys (bAnimContext *ac) static short paste_action_keys (bAnimContext *ac) { +#if 0 // XXX old animation system ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; @@ -495,6 +498,8 @@ static short paste_action_keys (bAnimContext *ac) } #endif +#endif // XXX old animation system + return 0; } @@ -595,7 +600,7 @@ static void delete_action_keys (bAnimContext *ac) if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -655,7 +660,7 @@ static void clean_action_keys (bAnimContext *ac, float thresh) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and clean curves */ @@ -727,7 +732,7 @@ static void sample_action_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -837,12 +842,12 @@ void ACT_OT_keyframes_sample (wmOperatorType *ot) /* ******************** Set Extrapolation-Type Operator *********************** */ +// XXX rename this operator... + /* defines for set extrapolation-type for selected keyframes tool */ EnumPropertyItem prop_actkeys_expo_types[] = { - {IPO_HORIZ, "CONSTANT", "Constant", ""}, - {IPO_DIR, "DIRECTIONAL", "Extrapolation", ""}, - {IPO_CYCL, "CYCLIC", "Cyclic", ""}, - {IPO_CYCLX, "CYCLIC_EXTRAPOLATION", "Cyclic Extrapolation", ""}, + {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", "Constant Extrapolation", ""}, + {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", "Linear Extrapolation", ""}, {0, NULL, NULL, NULL} }; @@ -854,14 +859,14 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); - /* loop through setting mode per ipo-curve - * Note: setting is on IPO-curve level not keyframe, so no need for Keyframe-Editing API - */ - for (ale= anim_data.first; ale; ale= ale->next) - setexprap_ipoloop(ale->key_data, mode); + /* loop through setting mode per F-Curve */ + for (ale= anim_data.first; ale; ale= ale->next) { + FCurve *fcu= (FCurve *)ale->data; + fcu->extend= mode; + } /* cleanup */ BLI_freelistN(&anim_data); @@ -917,9 +922,9 @@ void ACT_OT_keyframes_expotype (wmOperatorType *ot) /* defines for set ipo-type for selected keyframes tool */ EnumPropertyItem prop_actkeys_ipo_types[] = { - {IPO_CONST, "CONSTANT", "Constant Interpolation", ""}, - {IPO_LIN, "LINEAR", "Linear Interpolation", ""}, - {IPO_BEZ, "BEZIER", "Bezier Interpolation", ""}, + {BEZT_IPO_CONST, "CONSTANT", "Constant Interpolation", ""}, + {BEZT_IPO_LIN, "LINEAR", "Linear Interpolation", ""}, + {BEZT_IPO_BEZ, "BEZIER", "Bezier Interpolation", ""}, {0, NULL, NULL, NULL} }; @@ -932,14 +937,14 @@ static void setipo_action_keys(bAnimContext *ac, short mode) BeztEditFunc set_cb= ANIM_editkeyframes_ipo(mode); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation * Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here... */ for (ale= anim_data.first; ale; ale= ale->next) - ANIM_ipo_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, ANIM_editkeyframes_ipocurve_ipotype); + ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); /* cleanup */ BLI_freelistN(&anim_data); @@ -1012,7 +1017,7 @@ static void sethandles_action_keys(bAnimContext *ac, short mode) BeztEditFunc set_cb= ANIM_editkeyframes_handles(mode); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* loop through setting flags for handles @@ -1025,17 +1030,17 @@ static void sethandles_action_keys(bAnimContext *ac, short mode) /* check which type of handle to set (free or aligned) * - check here checks for handles with free alignment already */ - if (ANIM_ipo_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, NULL)) + if (ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, NULL)) toggle_cb= ANIM_editkeyframes_handles(HD_FREE); else toggle_cb= ANIM_editkeyframes_handles(HD_ALIGN); /* set handle-type */ - ANIM_ipo_keys_bezier_loop(NULL, ale->key_data, NULL, toggle_cb, calchandles_fcurve); + ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, toggle_cb, calchandles_fcurve); } else { /* directly set handle-type */ - ANIM_ipo_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); + ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); } } @@ -1127,11 +1132,11 @@ static int actkeys_cfrasnap_exec(bContext *C, wmOperator *op) memset(&bed, 0, sizeof(BeztEditData)); /* loop over action data, averaging values */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); BLI_freelistN(&anim_data); @@ -1186,7 +1191,7 @@ static void snap_action_keys(bAnimContext *ac, short mode) if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* get beztriple editing callbacks */ @@ -1200,14 +1205,14 @@ static void snap_action_keys(bAnimContext *ac, short mode) Object *nob= ANIM_nla_mapping_get(ac, ale); if (nob) { - ANIM_nla_mapping_apply_ipocurve(nob, ale->key_data, 0, 1); - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); - ANIM_nla_mapping_apply_ipocurve(nob, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1); } //else if (ale->type == ACTTYPE_GPLAYER) // snap_gplayer_frames(ale->data, mode); else - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); } BLI_freelistN(&anim_data); } @@ -1307,7 +1312,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode) if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* mirror keyframes */ @@ -1315,14 +1320,14 @@ static void mirror_action_keys(bAnimContext *ac, short mode) Object *nob= ANIM_nla_mapping_get(ac, ale); if (nob) { - ANIM_nla_mapping_apply_ipocurve(nob, ale->key_data, 0, 1); - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); - ANIM_nla_mapping_apply_ipocurve(nob, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1); } //else if (ale->type == ACTTYPE_GPLAYER) // snap_gplayer_frames(ale->data, mode); else - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); } BLI_freelistN(&anim_data); } diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c index 2695f77e902..30449ed0c30 100644 --- a/source/blender/editors/space_action/action_header.c +++ b/source/blender/editors/space_action/action_header.c @@ -1640,21 +1640,14 @@ void action_header_buttons(const bContext *C, ARegion *ar) xco += 5; uiBlockBeginAlign(block); - uiDefIconButBitI(block, TOGN, ADS_FILTER_NOOBJ, B_REDR, ICON_OBJECT, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Non-Armature Objects"); - uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Armature Objects"); + //uiDefIconButBitI(block, TOGN, ADS_FILTER_NOOBJ, B_REDR, ICON_OBJECT, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Non-Armature Objects"); + //uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Armature Objects"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_EDIT, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display ShapeKeys"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Materials"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Lamps"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Cameras"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Curves"); uiBlockEndAlign(block); - xco += 5; - - uiBlockBeginAlign(block); - uiDefIconButBitI(block, TOGN, ADS_FILTER_NOIPOS, B_REDR, ICON_IPO, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Object IPO's"); - uiDefIconButBitI(block, TOGN, ADS_FILTER_NOACTS, B_REDR, ICON_ACTION, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Actions"); - uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCONSTRAINTS, B_REDR, ICON_CONSTRAINT, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Object Constraints"); - uiBlockEndAlign(block); xco += 30; } else if (saction->mode == SACTCONT_ACTION) { // not too appropriate for shapekeys atm... diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 58574df7788..c4e2d0b972a 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -88,7 +88,8 @@ * keyframe to where the mouse clicked, */ // XXX port this to new listview code... -static void *get_nearest_action_key (bAnimContext *ac, int mval[2], float *selx, short *sel, short *ret_type, bActionChannel **par) +// XXX just merge this into the existing code! +static void *get_nearest_action_key (bAnimContext *ac, int mval[2], float *selx, short *sel, short *ret_type, bActionGroup **par) { ListBase anim_data = {NULL, NULL}; ListBase anim_keys = {NULL, NULL}; @@ -100,134 +101,127 @@ static void *get_nearest_action_key (bAnimContext *ac, int mval[2], float *selx, rctf rectf; void *data = NULL; float xmin, xmax, x, y; - int clickmin, clickmax; + int channel_index; short found = 0; - /* action-channel */ + /* action-group */ *par= NULL; + UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); - clickmin = (int) ((-y) / (ACHANNEL_STEP)); - clickmax = clickmin; + UI_view2d_listview_view_to_cell(v2d, 0, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index); /* x-range to check is +/- 7 on either side of mouse click (size of keyframe icon) */ UI_view2d_region_to_view(v2d, mval[0]-7, mval[1], &rectf.xmin, &rectf.ymin); UI_view2d_region_to_view(v2d, mval[0]+7, mval[1], &rectf.xmax, &rectf.ymax); - if (clickmax < 0) { - *ret_type= ANIMTYPE_NONE; - return NULL; - } - /* filter data */ - filter= (ANIMFILTER_FORDRAWING | ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); - for (ale= anim_data.first; ale; ale= ale->next) { - if (clickmax < 0) - break; - if (clickmin <= 0) { - /* found match - must return here... */ - Object *nob= ANIM_nla_mapping_get(ac, ale); - ActKeysInc *aki= init_aki_data(ac, ale); - - /* apply NLA-scaling correction? */ - if (nob) { - xmin= get_action_frame(nob, rectf.xmin); - xmax= get_action_frame(nob, rectf.xmax); - } - else { - xmin= rectf.xmin; - xmax= rectf.xmax; - } - - /* make list of keyframes */ - if (ale->key_data) { - switch (ale->datatype) { - case ALE_OB: - { - Object *ob= (Object *)ale->key_data; - ob_to_keylist(ob, &anim_keys, NULL, aki); - } - break; - case ALE_ACT: - { - bAction *act= (bAction *)ale->key_data; - action_to_keylist(act, &anim_keys, NULL, aki); - } - break; - case ALE_IPO: - { - Ipo *ipo= (Ipo *)ale->key_data; - ipo_to_keylist(ipo, &anim_keys, NULL, aki); - } - break; - case ALE_ICU: - { - IpoCurve *icu= (IpoCurve *)ale->key_data; - icu_to_keylist(icu, &anim_keys, NULL, aki); - } - break; + /* get channel */ + ale= BLI_findlink(&anim_data, channel_index); + if (ale == NULL) { + /* channel not found */ + printf("Error: animation channel (index = %d) not found in mouse_action_keys() \n", channel_index); + + BLI_freelistN(&anim_data); + return NULL; + } + + { + /* found match - must return here... */ + Object *nob= ANIM_nla_mapping_get(ac, ale); + ActKeysInc *aki= init_aki_data(ac, ale); + + /* apply NLA-scaling correction? */ + if (nob) { + xmin= get_action_frame(nob, rectf.xmin); + xmax= get_action_frame(nob, rectf.xmax); + } + else { + xmin= rectf.xmin; + xmax= rectf.xmax; + } + + /* make list of keyframes */ + if (ale->key_data) { + switch (ale->datatype) { + case ALE_OB: + { + Object *ob= (Object *)ale->key_data; + ob_to_keylist(ob, &anim_keys, NULL, aki); } - } - else if (ale->type == ANIMTYPE_GROUP) { - bActionGroup *agrp= (bActionGroup *)ale->data; - agroup_to_keylist(agrp, &anim_keys, NULL, aki); - } - else if (ale->type == ANIMTYPE_GPDATABLOCK) { - /* cleanup */ - BLI_freelistN(&anim_data); - - /* this channel currently doens't have any keyframes... must ignore! */ - *ret_type= ANIMTYPE_NONE; - return NULL; - } - else if (ale->type == ANIMTYPE_GPLAYER) { - bGPDlayer *gpl= (bGPDlayer *)ale->data; - gpl_to_keylist(gpl, &anim_keys, NULL, aki); - } - - /* loop through keyframes, finding one that was clicked on */ - for (ak= anim_keys.first; ak; ak= ak->next) { - if (IN_RANGE(ak->cfra, xmin, xmax)) { - *selx= ak->cfra; - found= 1; break; + case ALE_ACT: + { + bAction *act= (bAction *)ale->key_data; + action_to_keylist(act, &anim_keys, NULL, aki); } + break; + case ALE_FCURVE: + { + FCurve *fcu= (FCurve *)ale->key_data; + fcurve_to_keylist(fcu, &anim_keys, NULL, aki); + } + break; } - /* no matching keyframe found - set to mean frame value so it doesn't actually select anything */ - if (found == 0) - *selx= ((xmax+xmin) / 2); - - /* figure out what to return */ - if (ac->datatype == ANIMCONT_ACTION) { - *par= ale->owner; /* assume that this is an action channel */ - *ret_type= ale->type; - data = ale->data; - } - else if (ac->datatype == ANIMCONT_SHAPEKEY) { - data = ale->key_data; - *ret_type= ANIMTYPE_ICU; - } - else if (ac->datatype == ANIMCONT_DOPESHEET) { - data = ale->data; - *ret_type= ale->type; - } - else if (ac->datatype == ANIMCONT_GPENCIL) { - data = ale->data; - *ret_type= ANIMTYPE_GPLAYER; - } - - /* cleanup tempolary lists */ - BLI_freelistN(&anim_keys); - anim_keys.first = anim_keys.last = NULL; - + } + else if (ale->type == ANIMTYPE_GROUP) { + bActionGroup *agrp= (bActionGroup *)ale->data; + agroup_to_keylist(agrp, &anim_keys, NULL, aki); + } + else if (ale->type == ANIMTYPE_GPDATABLOCK) { + /* cleanup */ BLI_freelistN(&anim_data); - return data; + /* this channel currently doens't have any keyframes... must ignore! */ + *ret_type= ANIMTYPE_NONE; + return NULL; + } + else if (ale->type == ANIMTYPE_GPLAYER) { + bGPDlayer *gpl= (bGPDlayer *)ale->data; + gpl_to_keylist(gpl, &anim_keys, NULL, aki); + } + + /* loop through keyframes, finding one that was clicked on */ + for (ak= anim_keys.first; ak; ak= ak->next) { + if (IN_RANGE(ak->cfra, xmin, xmax)) { + *selx= ak->cfra; + found= 1; + break; + } + } + /* no matching keyframe found - set to mean frame value so it doesn't actually select anything */ + if (found == 0) + *selx= ((xmax+xmin) / 2); + + /* figure out what to return */ + if (ac->datatype == ANIMCONT_ACTION) { + *par= ale->owner; /* assume that this is an action channel */ + *ret_type= ale->type; + data = ale->data; + } + else if (ac->datatype == ANIMCONT_SHAPEKEY) { + data = ale->key_data; + *ret_type= ANIMTYPE_FCURVE; + } + else if (ac->datatype == ANIMCONT_DOPESHEET) { + data = ale->data; + *ret_type= ale->type; } - --clickmin; - --clickmax; + else if (ac->datatype == ANIMCONT_GPENCIL) { + data = ale->data; + *ret_type= ANIMTYPE_GPLAYER; + } + + /* cleanup tempolary lists */ + BLI_freelistN(&anim_keys); + anim_keys.first = anim_keys.last = NULL; + + BLI_freelistN(&anim_data); + + return data; } /* cleanup */ @@ -262,15 +256,22 @@ static void deselect_action_keys (bAnimContext *ac, short test, short sel) bAnimListElem *ale; int filter; + BeztEditData bed; + BeztEditFunc test_cb, sel_cb; + /* determine type-based settings */ if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); /* filter data */ ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); + /* init BezTriple looping data */ + memset(&bed, 0, sizeof(BeztEditData)); + test_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED); + /* See if we should be selecting or deselecting */ if (test) { for (ale= anim_data.first; ale; ale= ale->next) { @@ -281,20 +282,23 @@ static void deselect_action_keys (bAnimContext *ac, short test, short sel) //} } else { - if (is_ipo_key_selected(ale->key_data)) { - sel= 0; + if (ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, test_cb, NULL)) { + sel= SELECT_SUBTRACT; break; } } } } - + + /* convert sel to selectmode, and use that to get editor */ + sel_cb= ANIM_editkeyframes_select(sel); + /* Now set the flags */ for (ale= anim_data.first; ale; ale= ale->next) { //if (ale->type == ACTTYPE_GPLAYER) // set_gplayer_frame_selection(ale->data, sel); //else - set_ipo_key_selection(ale->key_data, sel); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL); } /* Cleanup */ @@ -313,9 +317,9 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op) /* 'standard' behaviour - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) - deselect_action_keys(&ac, 0, 2); + deselect_action_keys(&ac, 0, SELECT_INVERT); else - deselect_action_keys(&ac, 1, 1); + deselect_action_keys(&ac, 1, SELECT_ADD); /* set notifier tha things have changed */ ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead! @@ -413,22 +417,15 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short { /* loop over data selecting */ if (ale->key_data) { - if (ale->datatype == ALE_IPO) - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); - else if (ale->datatype == ALE_ICU) - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); + if (ale->datatype == ALE_FCURVE) + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); } else if (ale->type == ANIMTYPE_GROUP) { bActionGroup *agrp= ale->data; - bActionChannel *achan; - bConstraintChannel *conchan; + FCurve *fcu; - for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) { - ANIM_ipo_keys_bezier_loop(&bed, achan->ipo, ok_cb, select_cb, NULL); - - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) - ANIM_ipo_keys_bezier_loop(&bed, conchan->ipo, ok_cb, select_cb, NULL); - } + for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) + ANIM_fcurve_keys_bezier_loop(&bed, fcu, ok_cb, select_cb, NULL); } //else if (ale->type == ANIMTYPE_GPLAYER) { // borderselect_gplayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode); @@ -561,7 +558,7 @@ static void markers_selectkeys_between (bAnimContext *ac) bed.f2= max; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* select keys in-between */ @@ -569,12 +566,12 @@ static void markers_selectkeys_between (bAnimContext *ac) Object *nob= ANIM_nla_mapping_get(ac, ale); if (nob) { - ANIM_nla_mapping_apply_ipo(nob, ale->key_data, 0, 1); - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL); - ANIM_nla_mapping_apply_ipo(nob, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1); } else { - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL); } } @@ -624,11 +621,11 @@ static void columnselect_action_keys (bAnimContext *ac, short mode) // gplayer_make_cfra_list(ale->data, &elems, 1); } else { - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_to_cfraelem, NULL); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_to_cfraelem, NULL); } BLI_freelistN(&anim_data); break; @@ -661,7 +658,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode) if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -678,7 +675,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode) bed.f1= ce->cfra; /* select elements with frame number matching cfraelem */ - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); #if 0 // XXX reenable when Grease Pencil stuff is back if (ale->type == ANIMTYPE_GPLAYER) { @@ -770,10 +767,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode) bDopeSheet *ads= NULL; bAction *act= NULL; bActionGroup *agrp= NULL; - bActionChannel *achan= NULL; - bConstraintChannel *conchan= NULL; - Ipo *ipo= NULL; - IpoCurve *icu= NULL; + FCurve *fcu= NULL; bGPdata *gpd = NULL; bGPDlayer *gpl = NULL; @@ -792,23 +786,18 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode) gpd= (bGPdata *)ac->data; /* get channel and selection info */ - anim_channel= get_nearest_action_key(ac, mval, &selx, &sel, &chan_type, &achan); + anim_channel= get_nearest_action_key(ac, mval, &selx, &sel, &chan_type, &agrp); // xxx... if (anim_channel == NULL) return; switch (chan_type) { - case ANIMTYPE_ICU: - icu= (IpoCurve *)anim_channel; - break; - case ANIMTYPE_CONCHAN: - conchan= (bConstraintChannel *)anim_channel; - break; - case ANIMTYPE_ACHAN: - achan= (bActionChannel *)anim_channel; + case ANIMTYPE_FCURVE: + fcu= (FCurve *)anim_channel; break; case ANIMTYPE_GROUP: agrp= (bActionGroup *)anim_channel; break; +#if 0 // XXX fixme case ANIMTYPE_DSMAT: ipo= ((Material *)anim_channel)->ipo; break; @@ -824,12 +813,10 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode) case ANIMTYPE_DSSKEY: ipo= ((Key *)anim_channel)->ipo; break; +#endif // XXX fixme case ANIMTYPE_FILLACTD: act= (bAction *)anim_channel; break; - case ANIMTYPE_FILLIPOD: - ipo= ((Object *)anim_channel)->ipo; - break; case ANIMTYPE_OBJECT: ob= ((Base *)anim_channel)->object; break; @@ -844,17 +831,13 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode) if (selectmode == SELECT_REPLACE) { selectmode = SELECT_ADD; - deselect_action_keys(ac, 0, 0); + deselect_action_keys(ac, 0, SELECT_SUBTRACT); if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)) { ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - /* Highlight either an Action-Channel or Action-Group */ - if (achan) { - achan->flag |= ACHAN_SELECTED; - ANIM_action_set_active_channel(ac->data, ac->datatype, achan, ANIMTYPE_ACHAN); - } - else if (agrp) { + /* Highlight Action-Group? */ + if (agrp) { agrp->flag |= AGRP_SELECTED; ANIM_action_set_active_channel(ac->data, ac->datatype, agrp, ANIMTYPE_GROUP); } @@ -875,56 +858,33 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode) bed.f1= selx; /* apply selection to keyframes */ - if (icu) - ANIM_icu_keys_bezier_loop(&bed, icu, ok_cb, select_cb, NULL); - else if (ipo) - ANIM_ipo_keys_bezier_loop(&bed, ipo, ok_cb, select_cb, NULL); - else if (conchan) - ANIM_ipo_keys_bezier_loop(&bed, conchan->ipo, ok_cb, select_cb, NULL); - else if (achan) - ANIM_ipo_keys_bezier_loop(&bed, achan->ipo, ok_cb, select_cb, NULL); + // XXX use more generic code looper for this stuff... + if (fcu) + ANIM_fcurve_keys_bezier_loop(&bed, fcu, ok_cb, select_cb, NULL); else if (agrp) { - for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) { - ANIM_ipo_keys_bezier_loop(&bed, achan->ipo, ok_cb, select_cb, NULL); - - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) - ANIM_ipo_keys_bezier_loop(&bed, conchan->ipo, ok_cb, select_cb, NULL); - } + for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) + ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL); } else if (act) { - for (achan= act->chanbase.first; achan; achan= achan->next) { - ANIM_ipo_keys_bezier_loop(&bed, achan->ipo, ok_cb, select_cb, NULL); - - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) - ANIM_ipo_keys_bezier_loop(&bed, conchan->ipo, ok_cb, select_cb, NULL); - } + for (fcu= act->curves.first; fcu; fcu= fcu->next) + ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL); } else if (ob) { - if (ob->ipo) { - bed.f1= selx; - ANIM_ipo_keys_bezier_loop(&bed, ob->ipo, ok_cb, select_cb, NULL); - } + AnimData *adt; - if (ob->action) { - selxa= get_action_frame(ob, selx); - bed.f1= selxa; + /* Object's own animation */ + if (ob->adt && ob->adt->action) { + adt= ob->adt; - for (achan= ob->action->chanbase.first; achan; achan= achan->next) { - ANIM_ipo_keys_bezier_loop(&bed, achan->ipo, ok_cb, select_cb, NULL); - - for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) - ANIM_ipo_keys_bezier_loop(&bed, conchan->ipo, ok_cb, select_cb, NULL); - } - } - - if (ob->constraintChannels.first) { - bed.f1= selx; + selxa= get_action_frame(ob, selx); // xxx + bed.f1= selxa; - for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next) - ANIM_ipo_keys_bezier_loop(&bed, conchan->ipo, ok_cb, select_cb, NULL); + for (fcu= act->curves.first; fcu; fcu= fcu->next) + ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL); } - // FIXME: add data ipos too... + /* 'Sub-Object' animation data */ + // TODO... } //else if (gpl) // select_gpencil_frame(gpl, (int)selx, selectmode); @@ -944,7 +904,7 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec /* if select mode is replace, deselect all keyframes first */ if (select_mode==SELECT_REPLACE) { select_mode=SELECT_ADD; - deselect_action_keys(ac, 0, 0); + deselect_action_keys(ac, 0, SELECT_SUBTRACT); } /* set callbacks and editing data */ @@ -965,7 +925,7 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); /* select keys on the side where most data occurs */ @@ -973,14 +933,14 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec Object *nob= ANIM_nla_mapping_get(ac, ale); if (nob) { - ANIM_nla_mapping_apply_ipo(nob, ale->key_data, 0, 1); - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); - ANIM_nla_mapping_apply_ipo(nob, ale->key_data, 1, 1); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); + ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1); } //else if (ale->type == ANIMTYPE_GPLAYER) // borderselect_gplayer_frames(ale->data, min, max, SELECT_ADD); else - ANIM_ipo_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); } /* Cleanup */ @@ -1010,7 +970,7 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx) if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1023,7 +983,7 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx) bed.f1= selx; /* select elements with frame number matching cfraelem */ - ANIM_icu_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); + ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL); #if 0 // XXX reenable when Grease Pencil stuff is back if (ale->type == ANIMTYPE_GPLAYER) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 8546160cfef..40c0975a3b0 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2762,7 +2762,7 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, act, ANIMCONT_ACTION); /* loop through relevant data, removing keyframes from the ipo-blocks that were attached @@ -2975,7 +2975,7 @@ static void createTransActionData(bContext *C, TransInfo *t) if (ac.datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ONLYFCU); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype); /* which side of the current frame should be allowed */ @@ -3727,7 +3727,7 @@ void special_aftertrans_update(TransInfo *t) if (ac.datatype == ANIMCONT_DOPESHEET) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ONLYFCU); + short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); /* get channels to work on */ ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype); @@ -3741,9 +3741,9 @@ void special_aftertrans_update(TransInfo *t) ((cancelled == 0) || (duplicate)) ) { if (nob) { - //ANIM_nla_mapping_apply_ipocurve(nob, icu, 0, 1); + ANIM_nla_mapping_apply_fcurve(nob, fcu, 0, 1); posttrans_fcurve_clean(fcu); - //ANIM_nla_mapping_apply_ipocurve(nob, icu, 1, 1); + ANIM_nla_mapping_apply_fcurve(nob, fcu, 1, 1); } else posttrans_fcurve_clean(fcu); diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index e9ffad60f52..1c49489c3c5 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -289,12 +289,9 @@ typedef enum DOPESHEET_FILTERFLAG { ADS_FILTER_ONLYSEL = (1<<0), /* datatype-based filtering */ - ADS_FILTER_NOOBJ = (1<<4), - ADS_FILTER_NOARM = (1<<5), + ADS_FILTER_NOOBJ = (1<<4), // XXX + ADS_FILTER_NOARM = (1<<5), // XXX ADS_FILTER_NOSHAPEKEYS = (1<<6), - ADS_FILTER_NOIPOS = (1<<7), - ADS_FILTER_NOACTS = (1<<8), - ADS_FILTER_NOCONSTRAINTS = (1<<9), ADS_FILTER_NOCAM = (1<<10), ADS_FILTER_NOMAT = (1<<11), ADS_FILTER_NOLAM = (1<<12), @@ -302,7 +299,7 @@ typedef enum DOPESHEET_FILTERFLAG { /* combination filters (some only used at runtime) */ ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR), - ADS_FILTER_NLADUMMY = (ADS_FILTER_NOACTS|ADS_FILTER_NOSHAPEKEYS|ADS_FILTER_NOOBDATA), + ADS_FILTER_NLADUMMY = (ADS_FILTER_NOSHAPEKEYS|ADS_FILTER_NOOBDATA), } DOPESHEET_FILTERFLAG; /* DopeSheet general flags */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index d3bf525208f..e89e91c90eb 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -204,6 +204,9 @@ typedef struct FPoint { typedef struct FCurve { struct FCurve *next, *prev; + /* group */ + bActionGroup *grp; /* group that F-Curve belongs to */ + /* driver settings */ ChannelDriver *driver; /* only valid for drivers (i.e. stored in AnimData not Actions) */ /* evaluation settings */ -- cgit v1.2.3