Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation/anim_filter.c')
-rw-r--r--source/blender/editors/animation/anim_filter.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index dd406acff79..cca4fdbe331 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/animation/anim_filter.c
+ * \ingroup edanimation
+ */
+
+
/* This file contains a system used to provide a layer of abstraction between sources
* of animation data and tools in Animation Editors. The method used here involves
* generating a list of edit structures which enable tools to naively perform the actions
@@ -799,7 +804,9 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, void *o
/* ----------------------------------------- */
-/* NOTE: when this function returns true, the F-Curve is to be skipped */
+/* 'Only Selected' selected data filtering
+ * NOTE: when this function returns true, the F-Curve is to be skipped
+ */
static int skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
{
if (GS(owner_id->name) == ID_OB) {
@@ -871,6 +878,37 @@ static int skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id
return 0;
}
+/* (Display-)Name-based F-Curve filtering
+ * NOTE: when this function returns true, the F-Curve is to be skipped
+ */
+static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id)
+{
+ bAnimListElem ale_dummy = {0};
+ bAnimChannelType *acf;
+
+ /* create a dummy wrapper for the F-Curve */
+ ale_dummy.type = ANIMTYPE_FCURVE;
+ ale_dummy.id = owner_id;
+ ale_dummy.data = fcu;
+
+ /* get type info for channel */
+ acf = ANIM_channel_get_typeinfo(&ale_dummy);
+ if (acf && acf->name) {
+ char name[256]; /* hopefully this will be enough! */
+
+ /* get name */
+ acf->name(&ale_dummy, name);
+
+ /* check for partial match with the match string, assuming case insensitive filtering
+ * if match, this channel shouldn't be ignored!
+ */
+ return BLI_strcasestr(name, ads->searchstr) == NULL;
+ }
+
+ /* just let this go... */
+ return 1;
+}
+
/* find the next F-Curve that is usable for inclusion */
static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
{
@@ -880,7 +918,7 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct
* NOTE: we need to check if the F-Curves belong to the same group, as this gets called for groups too...
*/
for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
- /* special exception for Pose-Channel Based F-Curves:
+ /* special exception for Pose-Channel/Sequence-Strip/Node Based F-Curves:
* - the 'Only Selected' data filter should be applied to Pose-Channel data too, but those are
* represented as F-Curves. The way the filter for objects worked was to be the first check
* after 'normal' visibility, so this is done first here too...
@@ -892,7 +930,7 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct
if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
continue;
}
-
+
/* only include if visible (Graph Editor check, not channels check) */
if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
/* only work with this channel and its subchannels if it is editable */
@@ -901,6 +939,12 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct
if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) {
/* 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 (skip_fcurve_with_name(ads, fcu, owner_id))
+ continue;
+ }
+
/* this F-Curve can be used, so return it */
return fcu;
}