diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-03-12 18:54:56 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-03-12 19:33:48 +0300 |
commit | 741888ce086cffadd634e2877e7294b56e3d607b (patch) | |
tree | fe7209fb4a9eac984c399775c05543a9f567d541 /source | |
parent | 26bea849cfa1d020150e0862002d7d5463f07817 (diff) |
Cleanup: simplified Grease Pencil animdata filter
Part of the function was following an "if-ok: do-this" pattern, and then
mid-function switched to a "if-bad: skip" pattern. The function now just
uses the latter.
No functional changes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 4b0a4bcf46b..c1cd24f5a3c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1715,22 +1715,28 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, /* loop over layers as the conditions are acceptable (top-Down order) */ for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) { /* only if selected */ - if (ANIMCHANNEL_SELOK(SEL_GPL(gpl))) { - /* only if editable */ - if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_GPL(gpl)) { - /* active... */ - if (!(filter_mode & ANIMFILTER_ACTIVE) || (gpl->flag & GP_LAYER_ACTIVE)) { - /* skip layer if the name doesn't match the filter string */ - if ((ads) && (ads->searchstr[0] != '\0')) { - if (name_matches_dopesheet_filter(ads, gpl->info) == false) { - continue; - } - } - /* add to list */ - ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd, NULL); - } - } + if (!ANIMCHANNEL_SELOK(SEL_GPL(gpl))) { + continue; } + + /* only if editable */ + if ((filter_mode & ANIMFILTER_FOREDIT) && !EDITABLE_GPL(gpl)) { + continue; + } + + /* active... */ + if ((filter_mode & ANIMFILTER_ACTIVE) && (gpl->flag & GP_LAYER_ACTIVE) == 0) { + continue; + } + + /* skip layer if the name doesn't match the filter string */ + if (ads != NULL && ads->searchstr[0] != '\0' && + name_matches_dopesheet_filter(ads, gpl->info) == false) { + continue; + } + + /* add to list */ + ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd, NULL); } return items; |