Avoid temporary change of animation data flags for nodes filter
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 26 Dec 2013 12:46:54 +0000 (18:46 +0600)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 26 Dec 2013 12:50:22 +0000 (18:50 +0600)
Use temporary runtime flag of filter_mode argument instead.

This commit also fixes some weirdo mix of filter_mode with
filterflag bits.

source/blender/editors/animation/anim_filter.c
source/blender/editors/include/ED_anim_api.h

index ad74515528628b24125eccaaeabb90f8a6a4eb00..5e93fda0cd4a59949f9ee45bb0210d453efbcc37 100644 (file)
@@ -1042,9 +1042,11 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro
                 *      - this will also affect things like Drivers, and also works for Bone Constraints
                 */
                if (ads && owner_id) {
-                       if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN) == 0) {
-                               if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
-                                       continue;
+                       if ((filter_mode & ANIMFILTER_TMP_IGNORE_ONLYSEL) == 0) {
+                               if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN) == 0) {
+                                       if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
+                                               continue;
+                               }
                        }
                }
                
@@ -1541,21 +1543,17 @@ static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data,
 {
        bNode *node;
        size_t items = 0;
-       int group_filter_mode = filter_mode & ~ADS_FILTER_ONLYSEL;
 
        items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, ntree, filter_mode);
 
        for (node = ntree->nodes.first; node; node = node->next) {
                if (node->type == NODE_GROUP) {
                        if (node->id) {
-                               int filterflag = ads->filterflag;
-                               if ((filter_mode & ADS_FILTER_ONLYSEL) && (node->flag & NODE_SELECT) == 0) {
+                               if ((ads->filterflag & ADS_FILTER_ONLYSEL) && (node->flag & NODE_SELECT) == 0) {
                                        continue;
                                }
-                               /* TODO(sergey): A bit creepy, but this flag is not used from threads anyway. */
-                               ads->filterflag &= ~ADS_FILTER_ONLYSEL;
-                               items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, (bNodeTree *) node->id, group_filter_mode);
-                               ads->filterflag = filterflag;
+                               items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, (bNodeTree *) node->id,
+                                                                          filter_mode | ANIMFILTER_TMP_IGNORE_ONLYSEL);
                        }
                }
        }
index 8b9bb0a4ab00addaa49768be77462e47fbb4c469..dff5069d991744c8781df783a2a0024f988d5351 100644 (file)
@@ -225,7 +225,10 @@ typedef enum eAnimFilter_Flags {
        ANIMFILTER_NODUPLIS       = (1 << 11),
        
        /* for checking if we should keep some collapsed channel around (internal use only!) */
-       ANIMFILTER_TMP_PEEK       = (1 << 30)
+       ANIMFILTER_TMP_PEEK       = (1 << 30),
+
+       /* ignore ONLYSEL flag from filterflag, (internal use only!) */
+       ANIMFILTER_TMP_IGNORE_ONLYSEL = (1 << 31)
 } eAnimFilter_Flags;
 
 /* ---------- Flag Checking Macros ------------ */