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.c62
1 files changed, 51 insertions, 11 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 6d36daa854c..967002131c2 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -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
@@ -427,7 +432,7 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
/* this function allocates memory for a new bAnimListElem struct for the
* provided animation channel-data.
*/
-bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id)
+static bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id)
{
bAnimListElem *ale= NULL;
@@ -799,7 +804,9 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
/* ----------------------------------------- */
-/* 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;
}
@@ -973,7 +1017,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
* but the group isn't expanded...
*/
if ( (filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) && /* care about selection status */
- (EXPANDED_AGRP(agrp)==0) ) /* group isn't expanded */
+ (EXPANDED_AGRP(ac, agrp)==0) ) /* group isn't expanded */
{
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
@@ -1032,7 +1076,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
* - group is expanded
* - we just need the F-Curves present
*/
- if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
+ if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(ac, agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
{
/* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
* but to do this, we need to check that the group doesn't have it's not-visible flag set preventing
@@ -1601,10 +1645,6 @@ static int animdata_filter_dopesheet_obdata (bAnimContext *ac, ListBase *anim_da
break;
}
- /* special exception for drivers instead of action */
- if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
- expanded= EXPANDED_DRVD(adt);
-
/* include data-expand widget? */
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
/* check if filtering by active status */