diff options
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 40 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_draw.c | 189 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 211 | ||||
-rw-r--r-- | source/blender/editors/armature/poselib.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 10 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframes_edit.h | 5 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_select.c | 17 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 1 |
10 files changed, 177 insertions, 304 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 5b37c8071cd..f66e3a23bbf 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1405,10 +1405,6 @@ static EnumPropertyItem prop_animchannel_settings_types[] = { /* ------------------- */ -/* macro to be used in setflag_anim_channels */ -#define ASUBCHANNEL_SEL_OK(ale) ( (onlysel == 0) || \ - ((ale->id) && (GS(ale->id->name)==ID_OB) && (((Object *)ale->id)->flag & SELECT)) ) - /* Set/clear a particular flag (setting) for all selected + visible channels * setting: the setting to modify * mode: eAnimChannels_SetFlag diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index a7117af2151..b7264ae9a3e 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -127,6 +127,9 @@ static Key *actedit_get_shapekeys (bAnimContext *ac) /* Get data being edited in Action Editor (depending on current 'mode') */ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction) { + /* get dopesheet */ + ac->ads = &saction->ads; + /* sync settings with current view status, then return appropriate data */ switch (saction->mode) { case SACTCONT_ACTION: /* 'Action Editor' */ @@ -190,6 +193,7 @@ static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo) sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); sipo->ads->source= (ID *)ac->scene; } + ac->ads = sipo->ads; /* set settings for Graph Editor - "Selected = Editable" */ if (sipo->flag & SIPO_SELCUVERTSONLY) @@ -238,6 +242,7 @@ static short nlaedit_get_context (bAnimContext *ac, SpaceNla *snla) /* init dopesheet data if non-existant (i.e. for old files) */ if (snla->ads == NULL) snla->ads= MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet"); + ac->ads = snla->ads; /* sync settings with current view status, then return appropriate data */ /* update scene-pointer (no need to check for pinning yet, as not implemented) */ @@ -2038,6 +2043,32 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim return 1; } +/* ......................... */ + +/* filter data associated with a channel - usually for handling summary-channels in DopeSheet */ +static size_t animdata_filter_animchan (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAnimListElem *channel, int filter_mode) +{ + size_t items = 0; + + /* data to filter depends on channel type */ + // XXX: only common channel-types have been handled for now + switch (channel->type) { + case ANIMTYPE_SUMMARY: + items += animdata_filter_dopesheet(ac, anim_data, ads, filter_mode); + break; + + case ANIMTYPE_SCENE: + items += animdata_filter_dopesheet_scene(ac, anim_data, ads, channel->data, filter_mode); + break; + + case ANIMTYPE_OBJECT: + items += animdata_filter_dopesheet_ob(ac, anim_data, ads, channel->data, filter_mode); + break; + } + + return items; +} + /* ----------- Cleanup API --------------- */ /* Remove entries with invalid types in animation channel list */ @@ -2157,6 +2188,15 @@ size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_m items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode); } break; + + case ANIMCONT_CHANNEL: /* animation channel */ + { + bDopeSheet *ads = ac->ads; + + /* based on the channel type, filter relevant data for this */ + items = animdata_filter_animchan(ac, anim_data, ads, data, filter_mode); + } + break; } /* remove any 'weedy' entries */ diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 453027632eb..b774bc947e4 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -786,150 +786,71 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks) void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree *blocks) { - if (sce) { - AnimData *adt; - int filterflag; - - /* get filterflag */ - if (ads) - filterflag= ads->filterflag; - else - filterflag= 0; - - /* scene animdata */ - if ((sce->adt) && !(filterflag & ADS_FILTER_NOSCE)) { - adt= sce->adt; - - if (adt->action) - action_to_keylist(adt, adt->action, keys, blocks); - } - - /* world animdata */ - if ((sce->world) && (sce->world->adt) && !(filterflag & ADS_FILTER_NOWOR)) { - adt= sce->world->adt; - - if (adt->action) - action_to_keylist(adt, adt->action, keys, blocks); - } - - /* nodetree animdata */ - if ((sce->nodetree) && (sce->nodetree->adt) && !(filterflag & ADS_FILTER_NONTREE)) { - adt= sce->nodetree->adt; - - if (adt->action) - action_to_keylist(adt, adt->action, keys, blocks); - } - } + bAnimContext ac = {NULL}; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + bAnimListElem dummychan = {0}; + + if (sce == NULL) + return; + + /* create a dummy wrapper data to work with */ + dummychan.type = ANIMTYPE_SCENE; + dummychan.data = sce; + dummychan.id = &sce->id; + dummychan.adt = sce->adt; + + ac.ads = ads; + ac.data = &dummychan; + ac.datatype = ANIMCONT_CHANNEL; + + /* get F-Curves to take keyframes from */ + filter= ANIMFILTER_DATA_VISIBLE; // curves only + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* loop through each F-Curve, grabbing the keyframes */ + for (ale= anim_data.first; ale; ale= ale->next) + fcurve_to_keylist(ale->adt, ale->data, keys, blocks); + + BLI_freelistN(&anim_data); } void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *blocks) -{ - Key *key= ob_get_key(ob); - int filterflag= (ads)? ads->filterflag : 0; +{ + bAnimContext ac = {NULL}; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + bAnimListElem dummychan = {0}; + Base dummybase = {0}; - /* sanity check */ if (ob == NULL) return; - - /* Add action keyframes */ - if (ob->adt && ob->adt->action) - action_to_keylist(ob->adt, ob->adt->action, keys, blocks); - /* Add shapekey keyframes (only if dopesheet allows, if it is available) */ - if ((key && key->adt && key->adt->action) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) - action_to_keylist(key->adt, key->adt->action, keys, blocks); + /* create a dummy wrapper data to work with */ + dummybase.object = ob; - /* Add material keyframes */ - if ((ob->totcol) && !(filterflag & ADS_FILTER_NOMAT)) { - int a; - - for (a=1; a <= ob->totcol; a++) { - Material *ma= give_current_material(ob, a); - - /* there might not be a material */ - if (ELEM(NULL, ma, ma->adt)) - continue; - - /* add material's data */ - action_to_keylist(ma->adt, ma->adt->action, keys, blocks); - - // TODO: textures... - } - } + dummychan.type = ANIMTYPE_OBJECT; + dummychan.data = &dummybase; + dummychan.id = &ob->id; + dummychan.adt = ob->adt; - /* Add object data keyframes */ - switch (ob->type) { - case OB_CAMERA: /* ------- Camera ------------ */ - { - Camera *ca= (Camera *)ob->data; - - if ((ca->adt) && !(filterflag & ADS_FILTER_NOCAM)) - action_to_keylist(ca->adt, ca->adt->action, keys, blocks); - } - break; - case OB_LAMP: /* ---------- Lamp ----------- */ - { - Lamp *la= (Lamp *)ob->data; - - if ((la->adt) && !(filterflag & ADS_FILTER_NOLAM)) - action_to_keylist(la->adt, la->adt->action, keys, blocks); - } - break; - case OB_CURVE: /* ------- Curve ---------- */ - case OB_SURF: /* ------- Nurbs Surface ---------- */ - case OB_FONT: /* ------- Text Curve ---------- */ - { - Curve *cu= (Curve *)ob->data; - - if ((cu->adt) && !(filterflag & ADS_FILTER_NOCUR)) - action_to_keylist(cu->adt, cu->adt->action, keys, blocks); - } - break; - case OB_MBALL: /* ------- MetaBall ---------- */ - { - MetaBall *mb= (MetaBall *)ob->data; - - if ((mb->adt) && !(filterflag & ADS_FILTER_NOMBA)) - action_to_keylist(mb->adt, mb->adt->action, keys, blocks); - } - break; - case OB_ARMATURE: /* ------- Armature ---------- */ - { - bArmature *arm= (bArmature *)ob->data; - - if ((arm->adt) && !(filterflag & ADS_FILTER_NOARM)) - action_to_keylist(arm->adt, arm->adt->action, keys, blocks); - } - break; - case OB_MESH: /* ------- Mesh ---------- */ - { - Mesh *me= (Mesh *)ob->data; - - if ((me->adt) && !(filterflag & ADS_FILTER_NOMESH)) - action_to_keylist(me->adt, me->adt->action, keys, blocks); - } - break; - case OB_LATTICE: /* ------- Lattice ---------- */ - { - Lattice *lt= (Lattice *)ob->data; - - if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT)) - action_to_keylist(lt->adt, lt->adt->action, keys, blocks); - } - break; - } + ac.ads = ads; + ac.data = &dummychan; + ac.datatype = ANIMCONT_CHANNEL; - /* Add Particle System Keyframes */ - if ((ob->particlesystem.first) && !(filterflag & ADS_FILTER_NOPART)) { - ParticleSystem *psys = ob->particlesystem.first; - - for(; psys; psys=psys->next) { - if (ELEM(NULL, psys->part, psys->part->adt)) - continue; - else - action_to_keylist(psys->part->adt, psys->part->adt->action, keys, blocks); - } - } + /* get F-Curves to take keyframes from */ + filter= ANIMFILTER_DATA_VISIBLE; // curves only + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* loop through each F-Curve, grabbing the keyframes */ + for (ale= anim_data.first; ale; ale= ale->next) + fcurve_to_keylist(ale->adt, ale->data, keys, blocks); + + BLI_freelistN(&anim_data); } void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree *blocks) diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index ca8d1c232fa..a0b1b4a6ede 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -224,169 +224,94 @@ static short adt_keyframes_loop(KeyframeEditData *ked, AnimData *adt, KeyframeEd } /* This function is used to loop over the keyframe data in an Object */ -static short ob_keyframes_loop(KeyframeEditData *ked, Object *ob, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *ob, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) { - Key *key= ob_get_key(ob); + bAnimContext ac = {NULL}; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + int ret=0; + + bAnimListElem dummychan = {0}; + Base dummybase = {0}; - /* sanity check */ if (ob == NULL) return 0; - /* firstly, Object's own AnimData */ - if (ob->adt) { - if (adt_keyframes_loop(ked, ob->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } + /* create a dummy wrapper data to work with */ + dummybase.object = ob; - /* shapekeys */ - if ((key && key->adt) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) { - if (adt_keyframes_loop(ked, key->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - - /* Add material keyframes */ - if ((ob->totcol) && !(filterflag & ADS_FILTER_NOMAT)) { - int a; - - for (a=1; a <= ob->totcol; a++) { - Material *ma= give_current_material(ob, a); - - /* there might not be a material */ - if (ELEM(NULL, ma, ma->adt)) - continue; - - /* add material's data */ - if (adt_keyframes_loop(ked, ma->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } + dummychan.type = ANIMTYPE_OBJECT; + dummychan.data = &dummybase; + dummychan.id = &ob->id; + dummychan.adt = ob->adt; - /* Add object data keyframes */ - switch (ob->type) { - case OB_CAMERA: /* ------- Camera ------------ */ - { - Camera *ca= (Camera *)ob->data; - - if ((ca->adt) && !(filterflag & ADS_FILTER_NOCAM)) { - if (adt_keyframes_loop(ked, ca->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } - break; - case OB_LAMP: /* ---------- Lamp ----------- */ - { - Lamp *la= (Lamp *)ob->data; - - if ((la->adt) && !(filterflag & ADS_FILTER_NOLAM)) { - if (adt_keyframes_loop(ked, la->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } - break; - case OB_CURVE: /* ------- Curve ---------- */ - case OB_SURF: /* ------- Nurbs Surface ---------- */ - case OB_FONT: /* ------- Text Curve ---------- */ - { - Curve *cu= (Curve *)ob->data; - - if ((cu->adt) && !(filterflag & ADS_FILTER_NOCUR)) { - if (adt_keyframes_loop(ked, cu->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } - break; - case OB_MBALL: /* ------- MetaBall ---------- */ - { - MetaBall *mb= (MetaBall *)ob->data; - - if ((mb->adt) && !(filterflag & ADS_FILTER_NOMBA)) { - if (adt_keyframes_loop(ked, mb->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } - break; - case OB_ARMATURE: /* ------- Armature ---------- */ - { - bArmature *arm= (bArmature *)ob->data; - - if ((arm->adt) && !(filterflag & ADS_FILTER_NOARM)) { - if (adt_keyframes_loop(ked, arm->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } - break; - case OB_MESH: /* ------- Mesh ---------- */ - { - Mesh *me= (Mesh *)ob->data; - - if ((me->adt) && !(filterflag & ADS_FILTER_NOMESH)) { - if (adt_keyframes_loop(ked, me->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } + ac.ads = ads; + ac.data = &dummychan; + ac.datatype = ANIMCONT_CHANNEL; + + /* get F-Curves to take keyframes from */ + filter= ANIMFILTER_DATA_VISIBLE; // curves only + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* loop through each F-Curve, applying the operation as required, but stopping on the first one */ + for (ale= anim_data.first; ale; ale= ale->next) { + if (ANIM_fcurve_keyframes_loop(ked, (FCurve*)ale->data, key_ok, key_cb, fcu_cb)) { + ret = 1; break; - case OB_LATTICE: /* ---- Lattice ------ */ - { - Lattice *lt= (Lattice *)ob->data; - - if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT)) { - if (adt_keyframes_loop(ked, lt->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } } - break; } - /* Add Particle System Keyframes */ - if ((ob->particlesystem.first) && !(filterflag & ADS_FILTER_NOPART)) { - ParticleSystem *psys = ob->particlesystem.first; - - for(; psys; psys=psys->next) { - if (ELEM(NULL, psys->part, psys->part->adt)) - continue; - - if (adt_keyframes_loop(ked, psys->part->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } - } + BLI_freelistN(&anim_data); - return 0; + /* return return code - defaults to zero if nothing happened */ + return ret; } /* This function is used to loop over the keyframe data in a Scene */ -static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene *sce, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) { - World *wo= (sce) ? sce->world : NULL; - bNodeTree *ntree= (sce) ? sce->nodetree : NULL; + bAnimContext ac = {NULL}; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + int ret=0; + + bAnimListElem dummychan = {0}; - /* sanity check */ if (sce == NULL) return 0; - /* Scene's own animation */ - if (sce->adt) { - if (adt_keyframes_loop(ked, sce->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } + /* create a dummy wrapper data to work with */ + dummychan.type = ANIMTYPE_SCENE; + dummychan.data = sce; + dummychan.id = &sce->id; + dummychan.adt = sce->adt; - /* World */ - if (wo && wo->adt) { - if (adt_keyframes_loop(ked, wo->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; - } + ac.ads = ads; + ac.data = &dummychan; + ac.datatype = ANIMCONT_CHANNEL; - /* NodeTree */ - if (ntree && ntree->adt) { - if (adt_keyframes_loop(ked, ntree->adt, key_ok, key_cb, fcu_cb, filterflag)) - return 1; + /* get F-Curves to take keyframes from */ + filter= ANIMFILTER_DATA_VISIBLE; // curves only + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* loop through each F-Curve, applying the operation as required, but stopping on the first one */ + for (ale= anim_data.first; ale; ale= ale->next) { + if (ANIM_fcurve_keyframes_loop(ked, (FCurve*)ale->data, key_ok, key_cb, fcu_cb)) { + ret = 1; + break; + } } + BLI_freelistN(&anim_data); - return 0; + /* return return code - defaults to zero if nothing happened */ + return ret; } /* This function is used to loop over the keyframe data in a DopeSheet summary */ -static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int UNUSED(filterflag)) +static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -416,7 +341,7 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key /* --- */ /* This function is used to apply operation to all keyframes, regardless of the type */ -short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) { /* sanity checks */ if (ale == NULL) @@ -437,18 +362,18 @@ short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bAnimListElem *ale, return act_keyframes_loop(ked, (bAction *)ale->key_data, key_ok, key_cb, fcu_cb); case ALE_OB: /* object */ - return ob_keyframes_loop(ked, (Object *)ale->key_data, key_ok, key_cb, fcu_cb, filterflag); + return ob_keyframes_loop(ked, ads, (Object *)ale->key_data, key_ok, key_cb, fcu_cb); case ALE_SCE: /* scene */ - return scene_keyframes_loop(ked, (Scene *)ale->data, key_ok, key_cb, fcu_cb, filterflag); + return scene_keyframes_loop(ked, ads, (Scene *)ale->data, key_ok, key_cb, fcu_cb); case ALE_ALL: /* 'all' (DopeSheet summary) */ - return summary_keyframes_loop(ked, (bAnimContext *)ale->data, key_ok, key_cb, fcu_cb, filterflag); + return summary_keyframes_loop(ked, (bAnimContext *)ale->data, key_ok, key_cb, fcu_cb); } return 0; } /* This function is used to apply operation to all keyframes, regardless of the type without needed an AnimListElem wrapper */ -short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) { /* sanity checks */ if (data == NULL) @@ -469,11 +394,11 @@ short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, void *data, int return act_keyframes_loop(ked, (bAction *)data, key_ok, key_cb, fcu_cb); case ALE_OB: /* object */ - return ob_keyframes_loop(ked, (Object *)data, key_ok, key_cb, fcu_cb, filterflag); + return ob_keyframes_loop(ked, ads, (Object *)data, key_ok, key_cb, fcu_cb); case ALE_SCE: /* scene */ - return scene_keyframes_loop(ked, (Scene *)data, key_ok, key_cb, fcu_cb, filterflag); + return scene_keyframes_loop(ked, ads, (Scene *)data, key_ok, key_cb, fcu_cb); case ALE_ALL: /* 'all' (DopeSheet summary) */ - return summary_keyframes_loop(ked, (bAnimContext *)data, key_ok, key_cb, fcu_cb, filterflag); + return summary_keyframes_loop(ked, (bAnimContext *)data, key_ok, key_cb, fcu_cb); } return 0; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5b4da1a38df..57da7733223 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -840,7 +840,7 @@ static void poselib_apply_pose (tPoseLib_PreviewData *pld) /* start applying - only those channels which have a key at this point in time! */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* check if group has any keyframes */ - if (ANIM_animchanneldata_keyframes_loop(&ked, agrp, ALE_GROUP, NULL, group_ok_cb, NULL, 0)) { + if (ANIM_animchanneldata_keyframes_loop(&ked, NULL, agrp, ALE_GROUP, NULL, group_ok_cb, NULL)) { /* has keyframe on this frame, so try to get a PoseChannel with this name */ pchan= get_pose_channel(pose, agrp->name); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index c149102a6a7..8454f058238 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -77,6 +77,8 @@ typedef struct bAnimContext { struct SpaceLink *sl; /* editor data */ struct ARegion *ar; /* region within editor */ + struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */ + struct Scene *scene; /* active scene */ struct Object *obact; /* active object */ ListBase *markers; /* active set of markers */ @@ -85,7 +87,6 @@ typedef struct bAnimContext { } bAnimContext; /* Main Data container types */ -// XXX was ACTCONT_* typedef enum eAnimCont_Types { ANIMCONT_NONE = 0, /* invalid or no data */ ANIMCONT_ACTION, /* action (bAction) */ @@ -94,7 +95,8 @@ typedef enum eAnimCont_Types { ANIMCONT_DOPESHEET, /* dopesheet (bDopesheet) */ ANIMCONT_FCURVES, /* animation F-Curves (bDopesheet) */ ANIMCONT_DRIVERS, /* drivers (bDopesheet) */ - ANIMCONT_NLA /* nla (bDopesheet) */ + ANIMCONT_NLA, /* nla (bDopesheet) */ + ANIMCONT_CHANNEL /* animation channel (bAnimListElem) */ } eAnimCont_Types; /* --------------- Channels -------------------- */ @@ -256,8 +258,8 @@ typedef enum eAnimFilter_Flags { /* Action Channel Group */ #define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0) #define EXPANDED_AGRP(ac, agrp) \ - ( ( ((ac)->spacetype == SPACE_IPO) && (agrp->flag & AGRP_EXPANDED_G) ) || \ - ( ((ac)->spacetype != SPACE_IPO) && (agrp->flag & AGRP_EXPANDED) ) ) + ( ((!(ac) || ((ac)->spacetype != SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED)) || \ + (( (ac) && ((ac)->spacetype == SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED_G)) ) #define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE)) /* F-Curve Channels */ #define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED)==0) diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index e6fe7efbaba..d9e7317fc66 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -35,6 +35,7 @@ struct bAnimContext; struct bAnimListElem; +struct bDopeSheet; struct FCurve; struct BezTriple; struct Scene; @@ -187,11 +188,11 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, Keyf /* function for working with any type (i.e. one of the known types) of animation channel * - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG) */ -short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, struct bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag); +short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, struct bDopeSheet *ads, struct bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb); /* same as above, except bAnimListElem wrapper is not needed... * - keytype is eAnim_KeyType */ -short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag); +short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, struct bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb); /* functions for making sure all keyframes are in good order */ void ANIM_editkeyframes_refresh(struct bAnimContext *ac); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 0f84ae547ff..68dd0a8c256 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -198,7 +198,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter, filterflag; + int filter; KeyframeEditData ked; KeyframeEditFunc ok_cb, select_cb; @@ -214,14 +214,6 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* get filtering flag for dopesheet data (if applicable) */ - if (ac->datatype == ANIMCONT_DOPESHEET) { - bDopeSheet *ads= (bDopeSheet *)ac->data; - filterflag= ads->filterflag; - } - else - filterflag= 0; - /* get beztriple editing/validation funcs */ select_cb= ANIM_editkeyframes_select(selectmode); @@ -261,7 +253,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short if (ale->type == ANIMTYPE_GPLAYER) borderselect_gplayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode); else - ANIM_animchannel_keyframes_loop(&ked, ale, ok_cb, select_cb, NULL, filterflag); + ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); } /* set minimum extent to be the maximum of the next channel */ @@ -900,9 +892,6 @@ void ACTION_OT_select_leftright (wmOperatorType *ot) /* option 1) select keyframe directly under mouse */ static void actkeys_mselect_single (bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx) { - bDopeSheet *ads= (ac->datatype == ANIMCONT_DOPESHEET) ? ac->data : NULL; - int ds_filter = ((ads) ? (ads->filterflag) : (0)); - KeyframeEditData ked= {{NULL}}; KeyframeEditFunc select_cb, ok_cb; @@ -915,7 +904,7 @@ static void actkeys_mselect_single (bAnimContext *ac, bAnimListElem *ale, short if (ale->type == ANIMTYPE_GPLAYER) select_gpencil_frame(ale->data, selx, select_mode); else - ANIM_animchannel_keyframes_loop(&ked, ale, ok_cb, select_cb, NULL, ds_filter); + ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); } /* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 2d6ecbc4378..988ff49f20e 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1474,7 +1474,7 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op)) /* setup iterator, and iterate over all the keyframes in the action, applying this scaling */ ked.data= strip; - ANIM_animchanneldata_keyframes_loop(&ked, strip->act, ALE_ACT, NULL, bezt_apply_nlamapping, calchandles_fcurve, 0); + ANIM_animchanneldata_keyframes_loop(&ked, ac.ads, strip->act, ALE_ACT, NULL, bezt_apply_nlamapping, calchandles_fcurve); /* clear scale of strip now that it has been applied, * and recalculate the extents of the action now that it has been scaled diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index e55fbe11e52..b4cd4a5abdd 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -277,7 +277,6 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel) BLI_dlrbTree_init(&keys); /* init dopesheet settings */ - // FIXME: the ob_to_keylist function currently doesn't take this into account... if (onlysel) ads.filterflag |= ADS_FILTER_ONLYSEL; |