[Bf-blender-cvs] [741888ce086] master: Cleanup: simplified Grease Pencil animdata filter

Sybren A. Stüvel noreply at git.blender.org
Thu Mar 12 17:35:20 CET 2020


Commit: 741888ce086cffadd634e2877e7294b56e3d607b
Author: Sybren A. Stüvel
Date:   Thu Mar 12 16:54:56 2020 +0100
Branches: master
https://developer.blender.org/rB741888ce086cffadd634e2877e7294b56e3d607b

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.

===================================================================

M	source/blender/editors/animation/anim_filter.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list