Revision: 20753
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20753
Author:   aligorith
Date:     2009-06-09 14:28:10 +0200 (Tue, 09 Jun 2009)

Log Message:
-----------
NLA SoC: Improved anim-channel filtering flags for NLA so that channels don't 
need to be checked to be NLA-Tracks before being used. 

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
    branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
    
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c

Modified: 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c  
2009-06-09 12:18:20 UTC (rev 20752)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c  
2009-06-09 12:28:10 UTC (rev 20753)
@@ -1050,7 +1050,7 @@
        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 @@
        }
        
        /* 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 @@
                        { /* 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 @@
                        { /* 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 @@
        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 @@
        }
        
        /* 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 @@
                        { /* 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 @@
                        { /* 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);

Modified: 
branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h    
2009-06-09 12:18:20 UTC (rev 20752)
+++ branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h    
2009-06-09 12:28:10 UTC (rev 20753)
@@ -162,8 +162,9 @@
        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;
 
 

Modified: 
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c   
2009-06-09 12:18:20 UTC (rev 20752)
+++ branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c   
2009-06-09 12:28:10 UTC (rev 20753)
@@ -120,8 +120,8 @@
        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);

Modified: 
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
===================================================================
--- 
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
        2009-06-09 12:18:20 UTC (rev 20752)
+++ 
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
        2009-06-09 12:28:10 UTC (rev 20753)
@@ -2595,7 +2595,7 @@
                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 @@
        
        /* 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++;
                        }
                }
        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to