diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-06-26 12:35:31 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-06-26 12:44:14 +0300 |
commit | c0a8a29ae68f95bc0e0843774700868c19af1407 (patch) | |
tree | 1bc07abaa4909d579451b9a832400836573a2e60 | |
parent | 5f545dbde81352fd2e98fdb77e8a2d15434d2648 (diff) |
AnimEditors: Remove the toggles to enable name/collection-based filtering
Now the name/collection filters run when there's some text,
and don't run when the box is empty, thus reducing an extra
step that was needed before these options could be used.
-rw-r--r-- | release/scripts/startup/bl_ui/space_dopesheet.py | 41 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 11 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_action_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 23 |
5 files changed, 22 insertions, 69 deletions
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 729b14c9a20..99da6213188 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -43,22 +43,16 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False): if not genericFiltersOnly: if bpy.data.collections: row = layout.row(align=True) - row.prop(dopesheet, "show_only_collection_objects", text="") - if dopesheet.show_only_collection_objects: - row.prop(dopesheet, "filter_collection", text="") + row.prop(dopesheet, "filter_collection", text="") if not is_nla: row = layout.row(align=True) - row.prop(dopesheet, "show_only_matching_fcurves", text="") - if dopesheet.show_only_matching_fcurves: - row.prop(dopesheet, "filter_fcurve_name", text="") - row.prop(dopesheet, "use_multi_word_filter", text="") + row.prop(dopesheet, "filter_fcurve_name", text="") + row.prop(dopesheet, "use_multi_word_filter", text="") else: row = layout.row(align=True) - row.prop(dopesheet, "use_filter_text", text="") - if dopesheet.use_filter_text: - row.prop(dopesheet, "filter_text", text="") - row.prop(dopesheet, "use_multi_word_filter", text="") + row.prop(dopesheet, "filter_text", text="") + row.prop(dopesheet, "use_multi_word_filter", text="") ####################################### # Dopesheet Filtering Popovers @@ -94,25 +88,16 @@ class DopesheetFilterPopoverBase: if (not generic_filters_only) and (bpy.data.collections): row = layout.row(align=True) - row.prop(dopesheet, "show_only_collection_objects", text="") - sub = row.row(align=True) - sub.active = dopesheet.show_only_collection_objects - sub.prop(dopesheet, "filter_collection", text="") + row.prop(dopesheet, "filter_collection", text="") if not is_nla: row = layout.row(align=True) - row.prop(dopesheet, "show_only_matching_fcurves", text="") - sub = row.row(align=True) - sub.active = dopesheet.show_only_matching_fcurves - sub.prop(dopesheet, "filter_fcurve_name", text="") - sub.prop(dopesheet, "use_multi_word_filter", text="") + row.prop(dopesheet, "filter_fcurve_name", text="") + row.prop(dopesheet, "use_multi_word_filter", text="") else: row = layout.row(align=True) - row.prop(dopesheet, "use_filter_text", text="") - sub = row.row(align=True) - sub.active = dopesheet.use_filter_text - sub.prop(dopesheet, "filter_text", text="") - sub.prop(dopesheet, "use_multi_word_filter", text="") + row.prop(dopesheet, "filter_text", text="") + row.prop(dopesheet, "use_multi_word_filter", text="") # Standard = Present in all panels @classmethod @@ -275,10 +260,8 @@ class DOPESHEET_HT_editor_buttons(Header): row.prop(st.dopesheet, "show_hidden", text="") row = layout.row(align=True) - row.prop(st.dopesheet, "use_filter_text", text="") - if st.dopesheet.use_filter_text: - row.prop(st.dopesheet, "filter_text", text="") - row.prop(st.dopesheet, "use_multi_word_filter", text="") + row.prop(st.dopesheet, "filter_text", text="") + row.prop(st.dopesheet, "use_multi_word_filter", text="") layout.separator_spacer() diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index edbc1371332..ed4c574537b 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2300,18 +2300,9 @@ static int animchannels_find_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* update filter text, and ensure that filter is enabled if there's something there - * NOTE: we turn the filter off if there's nothing (this is a quick shortcut for dismissing) - */ + /* update filter text */ RNA_string_get(op->ptr, "query", ac.ads->searchstr); - if (ac.ads->searchstr[0]) { - ac.ads->filterflag |= ADS_FILTER_BY_FCU_NAME; - } - else { - ac.ads->filterflag &= ~ADS_FILTER_BY_FCU_NAME; - } - /* redraw */ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 25704bc7348..c59d24bbdf8 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1221,7 +1221,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan /* only include if this curve is active */ if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) { /* name based filtering... */ - if ( ((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) && (owner_id) ) { + if ( ((ads) && (ads->searchstr[0] != '\0')) && (owner_id) ) { if (skip_fcurve_with_name(ads, fcu, channel_type, owner, owner_id)) continue; } @@ -1453,7 +1453,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop /* only include if this track is active */ if (!(filter_mode & ANIMFILTER_ACTIVE) || (nlt->flag & NLATRACK_ACTIVE)) { /* name based filtering... */ - if (((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) && (owner_id)) { + if (((ads) && (ads->searchstr[0] != '\0')) && (owner_id)) { bool track_ok = false, strip_ok = false; /* check if the name of the track, or the strips it has are ok... */ @@ -1633,7 +1633,7 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee /* 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->filterflag & ADS_FILTER_BY_FCU_NAME)) { + if ((ads) && (ads->searchstr[0] != '\0')) { if (name_matches_dopesheet_filter(ads, gpl->info) == false) continue; } @@ -1741,7 +1741,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi * objects by the grouped status is on * - used to ease the process of doing multiple-character choreographies */ - if (ads->filterflag & ADS_FILTER_ONLYOBGROUP) { + if (ads->filter_grp != NULL) { if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0) continue; } @@ -2908,7 +2908,7 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Base *base, int filter_m * objects by the grouped status is on * - used to ease the process of doing multiple-character choreographies */ - if (ads->filterflag & ADS_FILTER_ONLYOBGROUP) { + if (ads->filter_grp != NULL) { if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0) return false; } diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index b20765ae187..0546dcb1a6c 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -598,8 +598,8 @@ typedef struct bDopeSheet { ID *source; /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */ ListBase chanbase; /* cache for channels (only initialized when pinned) */ // XXX not used! - struct Collection *filter_grp; /* object group for ADS_FILTER_ONLYOBGROUP filtering option */ - char searchstr[64]; /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */ + struct Collection *filter_grp; /* object group for option to only include objects that belong to this Collection */ + char searchstr[64]; /* string to search for in displayed names of F-Curves, or NlaTracks/GP Layers/etc. */ int filterflag; /* flags to use for filtering data */ int flag; /* standard flags */ @@ -621,7 +621,6 @@ typedef enum eDopeSheet_FilterFlag { /* general filtering */ ADS_FILTER_SUMMARY = (1 << 4), /* for 'DopeSheet' Editors - include 'summary' line */ - ADS_FILTER_ONLYOBGROUP = (1 << 5), /* only the objects in the specified object group get used */ /* datatype-based filtering */ ADS_FILTER_NOSHAPEKEYS = (1 << 6), @@ -650,7 +649,6 @@ typedef enum eDopeSheet_FilterFlag { /* general filtering 3 */ ADS_FILTER_INCL_HIDDEN = (1 << 26), /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */ - ADS_FILTER_BY_FCU_NAME = (1 << 27), /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */ ADS_FILTER_ONLY_ERRORS = (1 << 28), /* show only F-Curves which are disabled/have errors - for debugging drivers */ /* GPencil Mode */ diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 5b225b18a78..4f2654bb30e 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -326,13 +326,6 @@ static void rna_def_dopesheet(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); /* Object Collection Filtering Settings */ - prop = RNA_def_property(srna, "show_only_collection_objects", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP); - RNA_def_property_ui_text(prop, "Only Objects in Collection", - "Only include channels from objects in the specified collection"); - RNA_def_property_ui_icon(prop, ICON_GROUP, 0); - RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); - prop = RNA_def_property(srna, "filter_collection", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "filter_grp"); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -340,31 +333,19 @@ static void rna_def_dopesheet(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); /* FCurve Display Name Search Settings */ - prop = RNA_def_property(srna, "show_only_matching_fcurves", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME); - RNA_def_property_ui_text(prop, "Only Matching F-Curves", - "Only include F-Curves with names containing search text"); - RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0); - RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); - prop = RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "searchstr"); RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string"); + RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0); RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); /* NLA Name Search Settings (Shared with FCurve setting, but with different labels) */ - prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME); - RNA_def_property_ui_text(prop, "Only Matching Channels", - "Only include channels with names containing search text"); - RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0); - RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); - prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "searchstr"); RNA_def_property_ui_text(prop, "Name Filter", "Live filtering string"); RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); + RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); /* Multi-word fuzzy search option for name/text filters */ |