diff options
Diffstat (limited to 'source/blender/editors/animation/anim_filter.c')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 3416d72c021..2e65fff69f1 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -96,11 +96,12 @@ #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_node.h" -#include "BKE_sequencer.h" #include "ED_anim_api.h" #include "ED_markers.h" +#include "SEQ_sequencer.h" + #include "UI_resources.h" /* for TH_KEYFRAME_SCALE lookup */ /* ************************************************************ */ @@ -142,7 +143,7 @@ static Key *actedit_get_shapekeys(bAnimContext *ac) } /* XXX pinning is not available in 'ShapeKey' mode... */ - // if (saction->pin) return NULL; + // if (saction->pin) { return NULL; } /* shapekey data is stored with geometry data */ key = BKE_key_from_object(ob); @@ -223,9 +224,11 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction) case SACTCONT_MASK: /* Mask */ /* XXX review how this mode is handled... */ { /* TODO, other methods to get the mask */ - // Sequence *seq = BKE_sequencer_active_get(ac->scene); - // MovieClip *clip = ac->scene->clip; - // struct Mask *mask = seq ? seq->mask : NULL; +#if 0 + Sequence *seq = BKE_sequencer_active_get(ac->scene); + MovieClip *clip = ac->scene->clip; + struct Mask *mask = seq ? seq->mask : NULL; +#endif /* update scene-pointer (no need to check for pinning yet, as not implemented) */ saction->ads.source = (ID *)ac->scene; @@ -562,16 +565,19 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) /* ............................... */ -/* Add a new animation channel, taking into account the "peek" flag, which is used to just check +/** + * Add a new animation channel, taking into account the "peek" flag, which is used to just check * whether any channels will be added (but without needing them to actually get created). * - * ! This causes the calling function to return early if we're only "peeking" for channels + * \warning This causes the calling function to return early if we're only "peeking" for channels. + * + * XXX: ale_statement stuff is really a hack for one special case. It shouldn't really be needed. */ -// XXX: ale_statement stuff is really a hack for one special case. It shouldn't really be needed... #define ANIMCHANNEL_NEW_CHANNEL_FULL( \ channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement) \ - if (filter_mode & ANIMFILTER_TMP_PEEK) \ + if (filter_mode & ANIMFILTER_TMP_PEEK) { \ return 1; \ + } \ { \ bAnimListElem *ale = make_new_animlistelem( \ channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \ @@ -680,7 +686,7 @@ static bAnimListElem *make_new_animlistelem(void *data, ale->flag = adt->flag; - // XXX... drivers don't show summary for now + /* XXX drivers don't show summary for now. */ ale->key_data = NULL; ale->datatype = ALE_NONE; break; @@ -920,7 +926,7 @@ static bAnimListElem *make_new_animlistelem(void *data, /* NOTE: we just reuse the same expand filter for this case */ ale->flag = EXPANDED_GPD(gpd); - // XXX: currently, this is only used for access to its animation data + /* XXX: currently, this is only used for access to its animation data */ ale->key_data = (adt) ? adt->action : NULL; ale->datatype = ALE_ACT; @@ -1168,10 +1174,11 @@ static bool name_matches_dopesheet_filter(bDopeSheet *ads, char *name) } /* if we have a match somewhere, this returns true */ - return found; + return ((ads->flag & ADS_FLAG_INVERT_FILTER) == 0) ? found : !found; } /* fallback/default - just case insensitive, but starts from start of word */ - return BLI_strcasestr(name, ads->searchstr) != NULL; + bool found = BLI_strcasestr(name, ads->searchstr) != NULL; + return ((ads->flag & ADS_FLAG_INVERT_FILTER) == 0) ? found : !found; } /* (Display-)Name-based F-Curve filtering @@ -1233,7 +1240,7 @@ static bool fcurve_has_errors(FCurve *fcu) } /* check variables for other things that need linting... */ - // TODO: maybe it would be more efficient just to have a quick flag for this? + /* TODO: maybe it would be more efficient just to have a quick flag for this? */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { DRIVER_TARGETS_USED_LOOPER_BEGIN (dvar) { if (dtar->flag & DTAR_FLAG_INVALID) { @@ -1383,7 +1390,7 @@ static size_t animfilter_act_group(bAnimContext *ac, * but the group isn't expanded (1)... * (1) this only matters if we actually care about the hierarchy though. * - Hierarchy matters: this hack should be applied - * - Hierarchy ignored: cases like [#21276] won't work properly, unless we skip this hack + * - Hierarchy ignored: cases like T21276 won't work properly, unless we skip this hack */ if ( /* Care about hierarchy but group isn't expanded. */ @@ -1391,7 +1398,7 @@ static size_t animfilter_act_group(bAnimContext *ac, /* Care about selection status. */ (filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL))) { /* If the group itself isn't selected appropriately, - * we shouldn't consider it's children either. */ + * we shouldn't consider its children either. */ if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0) { return 0; } @@ -1413,7 +1420,7 @@ static size_t animfilter_act_group(bAnimContext *ac, /* special filter so that we can get just the F-Curves within the active group */ if (!(filter_mode & ANIMFILTER_ACTGROUPED) || (agrp->flag & AGRP_ACTIVE)) { /* for the Graph Editor, curves may be set to not be visible in the view to lessen - * clutter, but to do this, we need to check that the group doesn't have it's + * clutter, but to do this, we need to check that the group doesn't have its * not-visible flag set preventing all its sub-curves to be shown */ if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) { @@ -1475,7 +1482,7 @@ static size_t animfilter_action(bAnimContext *ac, } /* do groups */ - // TODO: do nested groups? + /* TODO: do nested groups? */ for (agrp = act->groups.first; agrp; agrp = agrp->next) { /* store reference to last channel of group */ if (agrp->channels.last) { @@ -1555,17 +1562,6 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), next = nlt->next; } - /* If we're in NLA-tweak-mode, don't show this track if it was disabled - * (due to tweaking) for now: - * - active track should still get shown though (even though it has disabled flag set) - */ - // FIXME: the channels after should still get drawn, just 'differently', - // and after an active-action channel. - if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED) && - (adt->act_track != nlt)) { - continue; - } - /* only work with this channel and its subchannels if it is editable */ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) { /* only include this track if selected in a way consistent with the filtering requirements */ @@ -1735,7 +1731,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, /* Only include this track if selected in a way consistent * with the filtering requirements. */ if (ANIMCHANNEL_SELOK(SEL_SHAPEKEY(kb))) { - // TODO: consider 'active' too? + /* TODO: consider 'active' too? */ /* owner-id here must be key so that the F-Curve can be resolved... */ ANIMCHANNEL_NEW_CHANNEL(kb, ANIMTYPE_SHAPEKEY, key, NULL); @@ -1745,7 +1741,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, } else { /* just use the action associated with the shapekey */ - // TODO: somehow manage to pass dopesheet info down here too? + /* TODO: somehow manage to pass dopesheet info down here too? */ if (key->adt) { if (filter_mode & ANIMFILTER_ANIMDATA) { if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(key->adt))) { @@ -1850,8 +1846,11 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, return items; } -/* Grab all Grease Pencil data-blocks in file. */ -// TODO: should this be amalgamated with the dopesheet filtering code? +/** + * Grab all Grease Pencil data-blocks in file. + * + * TODO: should this be amalgamated with the dope-sheet filtering code? + */ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, void *UNUSED(data), @@ -1940,8 +1939,9 @@ static size_t animdata_filter_ds_gpencil( tmp_items += animfilter_block_data(ac, &tmp_data, ads, &gpd->id, filter_mode); /* add Grease Pencil layers */ - // TODO: do these need a separate expander? - // XXX: what order should these go in? + + /* TODO: do these need a separate expander? + * XXX: what order should these go in? */ } END_ANIMFILTER_SUBCHANNELS; @@ -1950,7 +1950,7 @@ static size_t animdata_filter_ds_gpencil( /* include data-expand widget first */ if (filter_mode & ANIMFILTER_LIST_CHANNELS) { /* check if filtering by active status */ - // XXX: active check here needs checking + /* XXX: active check here needs checking */ if (ANIMCHANNEL_ACTIVEOK(gpd)) { ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_DSGPENCIL, gpd, NULL); } @@ -1986,7 +1986,7 @@ static size_t animdata_filter_ds_cachefile( /* include data-expand widget first */ if (filter_mode & ANIMFILTER_LIST_CHANNELS) { /* check if filtering by active status */ - // XXX: active check here needs checking + /* XXX: active check here needs checking */ if (ANIMCHANNEL_ACTIVEOK(cache_file)) { ANIMCHANNEL_NEW_CHANNEL(cache_file, ANIMTYPE_DSCACHEFILE, cache_file, NULL); } @@ -2037,7 +2037,7 @@ static size_t animdata_filter_mask(Main *bmain, size_t items = 0; /* For now, grab mask data-blocks directly from main. */ - // XXX: this is not good... + /* XXX: this is not good... */ for (mask = bmain->masks.first; mask; mask = mask->id.next) { ListBase tmp_data = {NULL, NULL}; size_t tmp_items = 0; @@ -2225,8 +2225,10 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, if ((tex->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE)) { /* owner_id as id instead of texture, * since it'll otherwise be impossible to track the depth. */ - // FIXME: perhaps as a result, textures should NOT be included under materials, - // but under their own section instead so that free-floating textures can also be animated. + + /* FIXME: perhaps as a result, textures should NOT be included under materials, + * but under their own section instead so that free-floating textures can also be animated. + */ tmp_items += animdata_filter_ds_nodetree( ac, &tmp_data, ads, (ID *)tex, tex->nodetree, filter_mode); } @@ -2416,7 +2418,7 @@ static void animfilter_modifier_idpoin_cb(void *afm_ptr, * which would be nice to animate (i.e. texture parameters) but which are not actually * attached to any other objects/materials/etc. in the scene */ -// TODO: do we want an expander for this? +/* TODO: do we want an expander for this? */ static size_t animdata_filter_ds_modifiers( bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode) { @@ -2910,7 +2912,7 @@ static size_t animdata_filter_ds_scene( void *cdata = NULL; /* determine the type of expander channels to use */ - // this is the best way to do this for now... + /* this is the best way to do this for now... */ ANIMDATA_FILTER_CASES( sce, /* Some useless long comment to prevent wrapping by old clang-format versions... */ {/* AnimData - no channel, but consider data */}, @@ -3178,9 +3180,9 @@ static Base **animdata_filter_ds_sorted_bases(bDopeSheet *ads, return sorted_bases; } -// TODO: implement pinning... -// (if and when pinning is done, what we need to do is to provide freeing mechanisms - -// to protect against data that was deleted). +/* TODO: implement pinning... + * (if and when pinning is done, what we need to do is to provide freeing mechanisms - + * to protect against data that was deleted). */ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, @@ -3237,7 +3239,7 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, if ((filter_mode & ANIMFILTER_LIST_CHANNELS) && !(ads->flag & ADS_FLAG_NO_DB_SORT) && (view_layer->object_bases.first != view_layer->object_bases.last)) { /* Filter list of bases (i.e. objects), sort them, then add their contents normally... */ - // TODO: Cache the old sorted order - if the set of bases hasn't changed, don't re-sort... + /* TODO: Cache the old sorted order - if the set of bases hasn't changed, don't re-sort... */ Base **sorted_bases; size_t num_bases; @@ -3248,7 +3250,7 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, items += animdata_filter_dopesheet_ob(ac, anim_data, ads, sorted_bases[i], filter_mode); } - // TODO: store something to validate whether any changes are needed? + /* TODO: store something to validate whether any changes are needed? */ /* free temporary data */ MEM_freeN(sorted_bases); @@ -3450,7 +3452,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, SpaceAction *saction = (SpaceAction *)ac->sl; bDopeSheet *ads = (saction) ? &saction->ads : NULL; - /* specially check for AnimData filter... [#36687] */ + /* specially check for AnimData filter, see T36687. */ if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) { /* all channels here are within the same AnimData block, hence this special case */ if (LIKELY(obact->adt)) { @@ -3471,7 +3473,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, { Key *key = (Key *)data; - /* specially check for AnimData filter... [#36687] */ + /* specially check for AnimData filter, see T36687. */ if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) { /* all channels here are within the same AnimData block, hence this special case */ if (LIKELY(key->adt)) { |