NLA SoC: Improved anim-channel filtering flags for NLA so that channels don't need...
authorJoshua Leung <aligorith@gmail.com>
Tue, 9 Jun 2009 12:28:10 +0000 (12:28 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 9 Jun 2009 12:28:10 +0000 (12:28 +0000)
source/blender/editors/animation/anim_filter.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/space_nla/nla_select.c
source/blender/editors/transform/transform_conversions.c

index cdda13d..6cb24a0 100644 (file)
@@ -1050,7 +1050,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
        int items = 0;
        
        /* add this object as a channel first */
-       if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
+       if ((filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) == 0) {
                /* check if filtering by selection */
                if ANIMCHANNEL_SELOK((base->flag & SELECT)) {
                        ale= make_new_animlistelem(base, ANIMTYPE_OBJECT, NULL, ANIMTYPE_NONE, NULL);
@@ -1062,7 +1062,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
        }
        
        /* if collapsed, don't go any further (unless adding keyframes only) */
-       if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) )
+       if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) )
                return items;
        
        /* Action, Drivers, or NLA */
@@ -1073,7 +1073,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
                        { /* nla */
 #if 0
                                /* include nla-expand widget? */
-                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
                                        ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_OBJECT, (ID *)ob);
                                        if (ale) {
                                                BLI_addtail(anim_data, ale);
@@ -1129,7 +1129,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
                        { /* nla */
 #if 0
                                /* include nla-expand widget? */
-                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
                                        ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_OBJECT, (ID *)ob);
                                        if (ale) {
                                                BLI_addtail(anim_data, ale);
@@ -1235,7 +1235,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
        int items = 0;
        
        /* add scene as a channel first (even if we aren't showing scenes we still need to show the scene's sub-data */
-       if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
+       if ((filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) == 0) {
                /* check if filtering by selection */
                if (ANIMCHANNEL_SELOK( (sce->flag & SCE_DS_SELECTED) )) {
                        ale= make_new_animlistelem(sce, ANIMTYPE_SCENE, NULL, ANIMTYPE_NONE, NULL);
@@ -1247,7 +1247,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
        }
        
        /* if collapsed, don't go any further (unless adding keyframes only) */
-       if ( (EXPANDED_SCEC(sce) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) )
+       if ( (EXPANDED_SCEC(sce) == 0) && !(filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) )
                return items;
                
        /* Action, Drivers, or NLA  for Scene */
@@ -1258,7 +1258,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
                        { /* nla */
 #if 0
                                /* include nla-expand widget? */
-                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
                                        ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_SCENE (ID *)sce);
                                        if (ale) {
                                                BLI_addtail(anim_data, ale);
@@ -1312,7 +1312,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
                        { /* nla */
 #if 0
                                /* include nla-expand widget? */
-                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
                                        ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_DSWOR (ID *)wo);
                                        if (ale) {
                                                BLI_addtail(anim_data, ale);
index dcaabb4..e44c7ff 100644 (file)
@@ -162,8 +162,9 @@ typedef enum eAnimFilter_Flags {
        ANIMFILTER_CHANNELS             = (1<<5),       /* make list for interface drawing */
        ANIMFILTER_ACTGROUPED   = (1<<6),       /* belongs to the active actiongroup */
        ANIMFILTER_CURVEVISIBLE = (1<<7),       /* F-Curve is visible for editing/viewing in Graph Editor */
-       ANIMFILTER_ACTIVE               = (1<<8),       /* channel should be 'active' */  // FIXME: this is only relevant for F-Curves for now
+       ANIMFILTER_ACTIVE               = (1<<8),       /* channel should be 'active' */
        ANIMFILTER_ANIMDATA             = (1<<9),       /* only return the underlying AnimData blocks (not the tracks, etc.) data comes from */
+       ANIMFILTER_NLATRACKS    = (1<<10),      /* only include NLA-tracks */
 } eAnimFilter_Flags;
 
 
index 463479c..730814d 100644 (file)
@@ -120,8 +120,8 @@ static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
        int filter;
        short smode;
        
-       /* determine type-based settings - curvesonly eliminates all the unnecessary channels... */
-       filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY);
+       /* determine type-based settings */
+       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS);
        
        /* filter data */
        ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
index 96f62f1..fb7d9c5 100644 (file)
@@ -2595,7 +2595,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
                return;
        
        /* filter data */
-       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
+       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT);
        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
                
        /* which side of the current frame should be allowed */
@@ -2613,18 +2613,15 @@ static void createTransNlaData(bContext *C, TransInfo *t)
        
        /* loop 1: count how many strips are selected (consider each strip as 2 points) */
        for (ale= anim_data.first; ale; ale= ale->next) {
-               /* only if a real NLA-track */
-               if (ale->type == ANIMTYPE_NLATRACK) {
-                       NlaTrack *nlt= (NlaTrack *)ale->data;
-                       NlaStrip *strip;
-                       
-                       /* only consider selected strips */
-                       for (strip= nlt->strips.first; strip; strip= strip->next) {
-                               // TODO: we can make strips have handles later on...
-                               if (strip->flag & NLASTRIP_FLAG_SELECT) {
-                                       if (FrameOnMouseSide(side, strip->start, (float)CFRA)) count++;
-                                       if (FrameOnMouseSide(side, strip->end, (float)CFRA)) count++;
-                               }
+               NlaTrack *nlt= (NlaTrack *)ale->data;
+               NlaStrip *strip;
+               
+               /* only consider selected strips */
+               for (strip= nlt->strips.first; strip; strip= strip->next) {
+                       // TODO: we can make strips have handles later on...
+                       if (strip->flag & NLASTRIP_FLAG_SELECT) {
+                               if (FrameOnMouseSide(side, strip->start, (float)CFRA)) count++;
+                               if (FrameOnMouseSide(side, strip->end, (float)CFRA)) count++;
                        }
                }
        }