NLA SoC: Bugfixes for previous commit
authorJoshua Leung <aligorith@gmail.com>
Sat, 30 May 2009 11:05:29 +0000 (11:05 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sat, 30 May 2009 11:05:29 +0000 (11:05 +0000)
* Compile fix in nla_draw.c
* Not totally correct yet, but now NLA-tracks get drawn too after action 'push-down'

source/blender/blenkernel/intern/nla.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/space_nla/nla_draw.c

index d062a2ab14b48bd6a5f262ef2d3ce1715fc2595c..3356f599c593a915260c86bdf435ad392f81e18b 100644 (file)
@@ -427,8 +427,10 @@ void BKE_nla_action_pushdown (AnimData *adt)
         * as that will cause us grief down the track
         */
        // TODO: what about modifiers?
-       if (action_has_motion(adt->action) == 0)
+       if (action_has_motion(adt->action) == 0) {
+               printf("BKE_nla_action_pushdown(): action has no data \n");
                return;
+       }
                
        /* add a new NLA track to house this action 
         *      - we could investigate trying to fit the action into an appropriately
@@ -436,8 +438,10 @@ void BKE_nla_action_pushdown (AnimData *adt)
         *        changes in blending behaviour...
         */
        nlt= add_nlatrack(adt);
-       if (nlt == NULL)
+       if (nlt == NULL) {
+               printf("BKE_nla_action_pushdown(): no NLA-track added \n");
                return;
+       }
        
        /* add a new NLA strip to the track, which references the active action */
        strip= add_nlastrip(nlt, adt->action);
@@ -448,6 +452,9 @@ void BKE_nla_action_pushdown (AnimData *adt)
                adt->action= NULL;
        }
        
+       // TEMP DEBUG...
+       printf("BKE_nla_action_pushdown(): NLA strip added.. done \n");
+       
        // TODO: set any other flags necessary here...
 }
 
index f12e9a51f32db87bd8f197977c4ef2382910b8d4..f1f2a31b9b1bdb36d96c50a1dd459878fe50721e 100644 (file)
@@ -1334,22 +1334,18 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
        /* scene-linked animation */
        // TODO: sequencer, composite nodes - are we to include those here too?
        {
-               short sceOk, worOk;
+               short sceOk= 0, worOk= 0;
                
                /* check filtering-flags if ok */
-               if (ads->filterflag) {
-                       if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
-                               sceOk= (ANIMDATA_HAS_DRIVERS(sce) && !(ads->filterflag & ADS_FILTER_NOSCE));
-                               worOk= ((sce->world) && ANIMDATA_HAS_DRIVERS(sce->world) && !(ads->filterflag & ADS_FILTER_NOWOR));
-                       }
-                       else {
-                               sceOk= (ANIMDATA_HAS_KEYS(sce) && !(ads->filterflag & ADS_FILTER_NOSCE));
-                               worOk= ((sce->world) && ANIMDATA_HAS_KEYS(sce->world) && !(ads->filterflag & ADS_FILTER_NOWOR));
-                       }
-               }
-               else {
-                       sceOk= (ANIMDATA_HAS_KEYS(sce));
-                       worOk= ((sce->world) && ANIMDATA_HAS_KEYS(sce->world));
+               ANIMDATA_FILTER_CASES(sce, 
+                       sceOk= !(ads->filterflag & ADS_FILTER_NOSCE);, 
+                       sceOk= !(ads->filterflag & ADS_FILTER_NOSCE);, 
+                       sceOk= !(ads->filterflag & ADS_FILTER_NOSCE);)
+               if (sce->world) {
+                       ANIMDATA_FILTER_CASES(sce->world, 
+                               worOk= !(ads->filterflag & ADS_FILTER_NOWOR);, 
+                               worOk= !(ads->filterflag & ADS_FILTER_NOWOR);, 
+                               worOk= !(ads->filterflag & ADS_FILTER_NOWOR);)
                }
                
                /* check if not all bad (i.e. so there is something to show) */
@@ -1391,13 +1387,17 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                }
                                
                                /* check filters for datatypes */
-                               if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
-                                       actOk= (ANIMDATA_HAS_DRIVERS(ob));
-                                       keyOk= ((key) && ANIMDATA_HAS_DRIVERS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
-                               }
-                               else {
-                                       actOk= ANIMDATA_HAS_KEYS(ob);
-                                       keyOk= ((key) && ANIMDATA_HAS_KEYS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
+                                       /* object */
+                               ANIMDATA_FILTER_CASES(ob, 
+                                       actOk= 1;, 
+                                       actOk= 1;, 
+                                       actOk= 1;)
+                               if (key) {
+                                       /* shapekeys */
+                                       ANIMDATA_FILTER_CASES(key, 
+                                               keyOk= 1;, 
+                                               keyOk= 1;, 
+                                               keyOk= 1;)
                                }
                                
                                /* materials - only for geometric types */
@@ -1412,18 +1412,13 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                                Material *ma= give_current_material(ob, a);
                                                
                                                /* if material has relevant animation data, break */
-                                               if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
-                                                       if (ANIMDATA_HAS_DRIVERS(ma)) {
-                                                               matOk= 1;
-                                                               break;
-                                                       }
-                                               }
-                                               else {
-                                                       if (ANIMDATA_HAS_KEYS(ma)) {
-                                                               matOk= 1;
-                                                               break;
-                                                       }
-                                               }
+                                               ANIMDATA_FILTER_CASES(ma, 
+                                                       matOk= 1;, 
+                                                       matOk= 1;, 
+                                                       matOk= 1;)
+                                                       
+                                               if (matOk) 
+                                                       break;
                                        }
                                }
                                
@@ -1432,19 +1427,19 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
                                        case OB_CAMERA: /* ------- Camera ------------ */
                                        {
                                                Camera *ca= (Camera *)ob->data;
-                                               if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
-                                                       dataOk= (ANIMDATA_HAS_DRIVERS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM));
-                                               else
-                                                       dataOk= (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM));                                               
+                                               ANIMDATA_FILTER_CASES(ca, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOCAM);, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOCAM);, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOCAM);)
                                        }
                                                break;
                                        case OB_LAMP: /* ---------- Lamp ----------- */
                                        {
                                                Lamp *la= (Lamp *)ob->data;
-                                               if (ads->filterflag & ADS_FILTER_ONLYDRIVERS)
-                                                       dataOk= (ANIMDATA_HAS_DRIVERS(la) && !(ads->filterflag & ADS_FILTER_NOLAM));
-                                               else
-                                                       dataOk= (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM));       
+                                               ANIMDATA_FILTER_CASES(la, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOLAM);, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOLAM);, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOLAM);)
                                        }
                                                break;
                                        default: /* --- other --- */
index 081064317d62fcc1af02bc7f8fd63d0c7c1dd1e2..8ff9522358ccdd2449fd59d98930e60176d306e3 100644 (file)
@@ -618,7 +618,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
                                glBegin(GL_LINES);
                                        glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y-7);
                                        glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y+7);
-                                       glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y-7;
+                                       glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y-7);
                                        glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y+7);
                                glEnd(); // GL_LINES