2.5 DopeSheet/Action Editor
authorJoshua Leung <aligorith@gmail.com>
Mon, 26 Jan 2009 04:13:38 +0000 (04:13 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 26 Jan 2009 04:13:38 +0000 (04:13 +0000)
* Made the various datatypes in the DopeSheet get shown again (NOTE: some of the types that don't get conversions to Animato yet may need some further checking).
* Did some code cleanup to allow F-Curve channels to always show RNA-based names correctly

source/blender/blenkernel/intern/ipo.c
source/blender/editors/animation/anim_channels.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_header.c
source/blender/editors/space_action/action_select.c
source/blender/editors/transform/transform_conversions.c

index 9fef1c657ca46804d6435188b5b9482d61b8338c..e6ee3a1468106f8e12c88d63a07e4d5b0be1bf48 100644 (file)
@@ -1065,6 +1065,8 @@ void do_versions_ipos_to_animato(Main *main)
                 * are likely to be drivers, but it's hard to trace that from here, so move this to Ob loop?
                 */
                if (key->ipo) {
+                       printf("\t\tconverting key->ipo %s -> %s \n", id->name+2, key->ipo->id.name+2);
+                       
                        /* Add AnimData block */
                        adt= BKE_id_add_animdata(id);
                        
index 44d85f2f153f8e58c051a28bac1d45a4b34c552b..3ebb6bb5a114bf79581bbe4a9808fe3970e75789 100644 (file)
@@ -155,7 +155,7 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short
        
        /* filter data */
        filter= ANIMFILTER_VISIBLE;
-       ANIM_animdata_filter(&anim_data, filter, data, datatype);
+       ANIM_animdata_filter(NULL, &anim_data, filter, data, datatype);
        
        /* See if we should be selecting or deselecting */
        if (test) {
@@ -646,7 +646,7 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS | ANIMFILTER_SEL);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* affect selected channels */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -840,7 +840,7 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop over data, doing border select */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -963,7 +963,7 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
        /* get the channel that was clicked on */
                /* filter channels */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
-       filter= ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       filter= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
                /* get channel from index */
        ale= BLI_findlink(&anim_data, channel_index);
index 272e0c64a8925bfe81bcc5f1227574e3e1335a2b..fc1a225eb77c3a84a5e981f30457fb34e0ab10b0 100644 (file)
@@ -278,7 +278,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)
+bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id)
 {
        bAnimListElem *ale= NULL;
        
@@ -293,6 +293,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                ale->owner= owner;
                ale->ownertype= ownertype;
                
+               ale->id= owner_id;
+               
                /* do specifics */
                switch (datatype) {
                        case ANIMTYPE_OBJECT:
@@ -334,7 +336,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                
                                ale->flag= FILTER_MAT_OBJD(ma);
                                
-                               ale->key_data= adt->action;
+                               ale->key_data= (adt) ? adt->action : NULL;
                                ale->datatype= ALE_ACT;
                        }
                                break;
@@ -345,7 +347,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                
                                ale->flag= FILTER_LAM_OBJD(la);
                                
-                               ale->key_data= adt->action;
+                               ale->key_data= (adt) ? adt->action : NULL;
                                ale->datatype= ALE_ACT;
                        }
                                break;
@@ -356,7 +358,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                
                                ale->flag= FILTER_CAM_OBJD(ca);
                                
-                               ale->key_data= adt->action;
+                               ale->key_data= (adt) ? adt->action : NULL;
                                ale->datatype= ALE_ACT;
                        }
                                break;
@@ -367,7 +369,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                
                                ale->flag= FILTER_CUR_OBJD(cu);
                                
-                               ale->key_data= adt->action;
+                               ale->key_data= (adt) ? adt->action : NULL;
                                ale->datatype= ALE_ACT;
                        }
                                break;
@@ -378,7 +380,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                
                                ale->flag= FILTER_SKE_OBJD(key); 
                                
-                               ale->key_data= adt->action;
+                               ale->key_data= (adt) ? adt->action : NULL;
                                ale->datatype= ALE_ACT;
                        }
                                break;
@@ -424,7 +426,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
 /* ----------------------------------------- */
 
 
-static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
+static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionGroup *grp, void *owner, short ownertype, int filter_mode, ID *owner_id)
 {
        bAnimListElem *ale = NULL;
        FCurve *fcu;
@@ -439,11 +441,9 @@ static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionG
                        /* only include this curve if selected */
                        if (!(filter_mode & ANIMFILTER_SEL) || (SEL_FCU(fcu))) {
                                /* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */
-                               ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, fcu, ANIMTYPE_FCURVE);
+                               ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
                                
                                if (ale) {
-                                       /* ID will only be Object if data to write to directly belongs there, otherwise, another pointer will be used */
-                                       ale->id= owner_id;
                                        BLI_addtail(anim_data, ale);
                                        items++;
                                }
@@ -455,12 +455,11 @@ static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionG
        return items;
 }
 
-static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter_mode, void *owner, short ownertype)
+static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter_mode, void *owner, short ownertype, ID *owner_id)
 {
        bAnimListElem *ale=NULL;
        bActionGroup *agrp;
        FCurve *lastchan=NULL;
-       short owned= (owner && ownertype) ? 1 : 0;
        int items = 0;
        
        /* loop over groups */
@@ -470,9 +469,8 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter
                if ((filter_mode & ANIMFILTER_CHANNELS) || !(filter_mode & ANIMFILTER_CURVESONLY)) {
                        /* check if filtering by selection */
                        if ( !(filter_mode & ANIMFILTER_SEL) || SEL_AGRP(agrp) ) {
-                               ale= make_new_animlistelem(agrp, ANIMTYPE_GROUP, NULL, ANIMTYPE_NONE);
+                               ale= make_new_animlistelem(agrp, ANIMTYPE_GROUP, NULL, ANIMTYPE_NONE, owner_id);
                                if (ale) {
-                                       if (owned) ale->id= owner;
                                        BLI_addtail(anim_data, ale);
                                        items++;
                                }
@@ -501,7 +499,7 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter
                        {
                                if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
                                        // XXX the 'owner' info here needs review...
-                                       items += animdata_filter_fcurves(anim_data, agrp->channels.first, agrp, filter_mode, ((owned)?owner:NULL));
+                                       items += animdata_filter_fcurves(anim_data, agrp->channels.first, agrp, owner, ownertype, filter_mode, owner_id);
                                        
                                        /* remove group from filtered list if last element is group 
                                         * (i.e. only if group had channels, which were all hidden)
@@ -521,19 +519,18 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter
        /* loop over un-grouped F-Curves (only if we're not only considering those channels in the animive group) */
        if (!(filter_mode & ANIMFILTER_ACTGROUPED))  {
                // XXX the 'owner' info here needs review...
-               items += animdata_filter_fcurves(anim_data, (lastchan)?(lastchan->next):(act->curves.first), NULL, filter_mode, ((owned)?owner:NULL));
+               items += animdata_filter_fcurves(anim_data, (lastchan)?(lastchan->next):(act->curves.first), NULL, owner, ownertype, filter_mode, owner_id);
        }
        
        /* return the number of items added to the list */
        return items;
 }
 
-static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode, void *owner, short ownertype)
+static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode, void *owner, short ownertype, ID *owner_id)
 {
        bAnimListElem *ale;
        KeyBlock *kb;
        //FCurve *fcu;
-       short owned= (owner && ownertype)? 1 : 0;
        int i, items=0;
        
        /* are we filtering for display or editing */
@@ -565,7 +562,7 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m
                        }
 #endif // XXX fixme... old system
                        
-                       if (owned) ale->id= owner;
+                       ale->id= owner_id;
                        
                        BLI_addtail(anim_data, ale);
                        items++;
@@ -667,7 +664,7 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
        
        /* include materials-expand widget? */
        if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
-               ale= make_new_animlistelem(ob, ANIMTYPE_FILLMATD, base, ANIMTYPE_OBJECT);
+               ale= make_new_animlistelem(ob, ANIMTYPE_FILLMATD, base, ANIMTYPE_OBJECT, (ID *)ob);
                if (ale) {
                        BLI_addtail(anim_data, ale);
                        items++;
@@ -688,7 +685,7 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
                        /* include material-expand widget? */
                        // hmm... do we need to store the index of this material in the array anywhere?
                        if (filter_mode & ANIMFILTER_CHANNELS) {
-                               ale= make_new_animlistelem(ma, ANIMTYPE_DSMAT, base, ANIMTYPE_OBJECT);
+                               ale= make_new_animlistelem(ma, ANIMTYPE_DSMAT, base, ANIMTYPE_OBJECT, (ID *)ma);
                                if (ale) {
                                        BLI_addtail(anim_data, ale);
                                        items++;
@@ -698,112 +695,81 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads,
                        /* add material's ipo-curve channels? */
                        if (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
                                //items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
+                                       // XXX the 'owner' info here is still subject to improvement
+                               items += animdata_filter_action(anim_data, ma->adt->action, filter_mode, ma, ANIMTYPE_DSMAT, (ID *)ma);
                        }
                }
-
        }
        
        /* return the number of items added to the list */
        return items;
 }
 
-#if 0 // XXX old anim sys
-
-static int animdata_filter_dopesheet_cam (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
+static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
        bAnimListElem *ale=NULL;
        Object *ob= base->object;
-       Camera *ca= (Camera *)ob->data;
-       int items = 0;
+       IdAdtTemplate *iat= ob->data;
+       short type=0, expanded=0;
+       int items= 0;
        
-       /* include camera-expand widget? */
-       if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) {
-               ale= make_new_animlistelem(ca, ANIMTYPE_DSCAM, base, ANIMTYPE_OBJECT);
-               if (ale) {
-                       BLI_addtail(anim_data, ale);
-                       items++;
+       /* get settings based on data type */
+       switch (ob->type) {
+               case OB_CAMERA: /* ------- Camera ------------ */
+               {
+                       Camera *ca= (Camera *)ob->data;
+                       
+                       type= ANIMTYPE_DSCAM;
+                       expanded= FILTER_CAM_OBJD(ca);
                }
-       }
-       
-       /* add camera ipo-curve channels? */
-       if ( (FILTER_CAM_OBJD(ca) || (filter_mode & ANIMFILTER_ONLYFCU)) && 
-                 !(filter_mode & ANIMFILTER_IPOKEYS) ) 
-       {
-               items += animdata_filter_ipocurves(anim_data, ca->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ca);
-       }
-       
-       /* return the number of items added to the list */
-       return items;
-}
-
-static int animdata_filter_dopesheet_lamp (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
-{
-       bAnimListElem *ale=NULL;
-       Object *ob= base->object;
-       Lamp *la= (Lamp *)ob->data;
-       int items = 0;
-       
-       /* include lamp-expand widget? */
-       if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) {
-               ale= make_new_animlistelem(la, ANIMTYPE_DSLAM, base, ANIMTYPE_OBJECT);
-               if (ale) {
-                       BLI_addtail(anim_data, ale);
-                       items++;
+                       break;
+               case OB_LAMP: /* ---------- Lamp ----------- */
+               {
+                       Lamp *la= (Lamp *)ob->data;
+                       
+                       type= ANIMTYPE_DSLAM;
+                       expanded= FILTER_LAM_OBJD(la);
+               }
+                       break;
+               case OB_CURVE: /* ------- Curve ---------- */
+               {
+                       Curve *cu= (Curve *)ob->data;
+                       
+                       type= ANIMTYPE_DSCUR;
+                       expanded= FILTER_CUR_OBJD(cu);
                }
+                       break;
        }
        
-       /* add lamp ipo-curve channels? */
-       if ( (FILTER_LAM_OBJD(la) || (filter_mode & ANIMFILTER_ONLYFCU)) && 
-                 !(filter_mode & ANIMFILTER_IPOKEYS) ) 
-       {
-               items += animdata_filter_ipocurves(anim_data, la->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)la);
+       /* include data-expand widget? */
+       if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {               
+               ale= make_new_animlistelem(iat, type, base, ANIMTYPE_OBJECT, (ID *)iat);
+               if (ale) BLI_addtail(anim_data, ale);
        }
        
-       /* return the number of items added to the list */
-       return items;
-}
-
-static int animdata_filter_dopesheet_curve (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
-{
-       bAnimListElem *ale=NULL;
-       Object *ob= base->object;
-       Curve *cu= (Curve *)ob->data;
-       int items = 0;
-       
-       /* include curve-expand widget? */
-       if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) {
-               ale= make_new_animlistelem(cu, ANIMTYPE_DSCUR, base, ANIMTYPE_OBJECT);
-               if (ale) {
-                       BLI_addtail(anim_data, ale);
-                       items++;
-               }
-       }
-       
-       /* add curve ipo-curve channels? */
-       if ( (FILTER_CUR_OBJD(cu) || (filter_mode & ANIMFILTER_ONLYFCU)) && 
-                 !(filter_mode & ANIMFILTER_IPOKEYS) ) 
-       {
-               items += animdata_filter_ipocurves(anim_data, cu->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)cu);
+       /* add object-data animation channels? */
+       if ((expanded) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+               // XXX the 'owner' info here is still subject to improvement
+               items += animdata_filter_action(anim_data, iat->adt->action, filter_mode, iat, type, (ID *)iat);
        }
        
        /* return the number of items added to the list */
        return items;
 }
-#endif // XXX old anim sys
 
 static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
        bAnimListElem *ale=NULL;
        Scene *sce= (Scene *)ads->source;
        Object *ob= base->object;
-//     Key *key= ob_get_key(ob);
+       Key *key= ob_get_key(ob);
        int items = 0;
        
        /* add this object as a channel first */
        if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
                /* check if filtering by selection */
                if ( !(filter_mode & ANIMFILTER_SEL) || ((base->flag & SELECT) || (base == sce->basact)) ) {
-                       ale= make_new_animlistelem(base, ANIMTYPE_OBJECT, NULL, ANIMTYPE_NONE);
+                       ale= make_new_animlistelem(base, ANIMTYPE_OBJECT, NULL, ANIMTYPE_NONE, NULL);
                        if (ale) {
                                BLI_addtail(anim_data, ale);
                                items++;
@@ -821,9 +787,8 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
                
                /* include action-expand widget? */
                if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
-                       ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT);
+                       ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT, (ID *)ob);
                        if (ale) {
-                               ale->id= (ID *)ob; // err.... is this a good idea?
                                BLI_addtail(anim_data, ale);
                                items++;
                        }
@@ -832,16 +797,15 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
                /* add F-Curve channels? */
                if (EXPANDED_ACTC(adt->action) || !(filter_mode & ANIMFILTER_CHANNELS)) {
                        // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?)
-                       items += animdata_filter_action(anim_data, adt->action, filter_mode, ob, ANIMTYPE_OBJECT); 
+                       items += animdata_filter_action(anim_data, adt->action, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob); 
                }
        }
        
-#if 0 // XXX fixme... 
        /* ShapeKeys? */
        if ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) {
                /* include shapekey-expand widget? */
                if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
-                       ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT);
+                       ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT, (ID *)ob);
                        if (ale) {
                                BLI_addtail(anim_data, ale);
                                items++;
@@ -850,42 +814,39 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
                
                /* add channels */
                if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
-                       items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT);
+                       items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
                }
        }
-#endif
        
 
        /* Materials? */
        if ((ob->totcol) && !(ads->filterflag & ADS_FILTER_NOMAT))
                items += animdata_filter_dopesheet_mats(anim_data, ads, base, filter_mode);
        
-#if 0
        /* Object Data */
        switch (ob->type) {
                case OB_CAMERA: /* ------- Camera ------------ */
                {
                        Camera *ca= (Camera *)ob->data;
-                       if ((ca->ipo) && !(ads->filterflag & ADS_FILTER_NOCAM))
-                               items += animdata_filter_dopesheet_cam(anim_data, ads, base, filter_mode);
+                       if (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM))
+                               items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
                }
                        break;
                case OB_LAMP: /* ---------- Lamp ----------- */
                {
                        Lamp *la= (Lamp *)ob->data;
-                       if ((la->ipo) && !(ads->filterflag & ADS_FILTER_NOLAM))
-                               items += animdata_filter_dopesheet_lamp(anim_data, ads, base, filter_mode);
+                       if (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM))
+                               items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
                }
                        break;
                case OB_CURVE: /* ------- Curve ---------- */
                {
                        Curve *cu= (Curve *)ob->data;
-                       if ((cu->ipo) && !(ads->filterflag & ADS_FILTER_NOCUR))
-                               items += animdata_filter_dopesheet_curve(anim_data, ads, base, filter_mode);
+                       if (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR))
+                               items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode);
                }
                        break;
        }
-#endif
        
        /* return the number of items added to the list */
        return items;
@@ -1028,21 +989,22 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
  *             will be placed for use.
  *     filter_mode: how should the data be filtered - bitmapping accessed flags
  */
-int ANIM_animdata_filter (ListBase *anim_data, int filter_mode, void *data, short datatype)
+int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype)
 {
        int items = 0;
        
        /* only filter data if there's somewhere to put it */
        if (data && anim_data) {
                bAnimListElem *ale, *next;
+               Object *obact= (ac) ? ac->obact : NULL;
                
                /* firstly filter the data */
                switch (datatype) {
                        case ANIMCONT_ACTION:
-                               items= animdata_filter_action(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE);
+                               items= animdata_filter_action(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
                                break;
                        case ANIMCONT_SHAPEKEY:
-                               items= animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE);
+                               items= animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
                                break;
                        case ANIMCONT_GPENCIL:
                                //items= animdata_filter_gpencil(anim_data, data, filter_mode);
index 5596e244aeea9c8473d17c3f75562bf2d1968b25..66049d5e5f7b73ff082a176d526d72109757230e 100644 (file)
@@ -188,7 +188,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
        
        /* filter animation data */
        filter= ANIMFILTER_CURVESONLY; 
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop over ipo-curves that are likely to have been edited, and check them */
        for (ale= anim_data.first; ale; ale= ale->next) {
index bd6fe4f0fc8fd3c8a86181aeda96d7d25af8efb1..11ffa435149e1a8e210e2d7e51687b39543cf613 100644 (file)
@@ -206,7 +206,7 @@ typedef enum eAnimFilter_Flags {
 /* Obtain list of filtered Animation channels to operate on.
  * Returns the number of channels in the list
  */
-int ANIM_animdata_filter(ListBase *anim_data, int filter_mode, void *data, short datatype);
+int ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype);
 
 /* Obtain current anim-data context from Blender Context info.
  * Returns whether the operation was successful. 
index de7453654ff1fc8f6379c32bd16cad44afd87bda..227881408a0aac8e8d3d35f83f52886287b9633e 100644 (file)
@@ -409,7 +409,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
        
        /* build list of channels to draw */
        filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
-       items= ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* Update max-extent of channels here (taking into account scrollers):
         *      - this is done to allow the channel list to be scrollable, but must be done here
@@ -622,15 +622,20 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
                                        //group= (ale->grp) ? 1 : 0;
                                        //grp= ale->grp;
                                        
-                                       // XXX this needs to be more detailed...
-                                       if (ale->id) {
-                                               if (GS(ale->id->name) == ID_MA)
+                                       switch (ale->ownertype) {
+                                               case ANIMTYPE_NONE:     /* no owner */
+                                               case ANIMTYPE_FCURVE: 
+                                                       offset= 0;
+                                                       break;
+                                                       
+                                               case ANIMTYPE_DSMAT: /* for now, this is special case for materials */
                                                        offset= 21;
-                                               else
+                                                       break;
+                                                       
+                                               default:
                                                        offset= 14;
+                                                       break;
                                        }
-                                       else
-                                               offset= 0;
                                        
                                        if (fcu->flag & FCURVE_MUTED)
                                                mute = ICON_MUTE_IPO_ON;
@@ -988,7 +993,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
        
        /* build list of channels to draw */
        filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
-       items= ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* Update max-extent of channels here (taking into account scrollers):
         *      - this is done to allow the channel list to be scrollable, but must be done here
index 8b89c41775ce79dc6f769858e0dab4560cbde47a..d618d2869c8582d6ad1f3d80949796d4bd71665c 100644 (file)
@@ -98,7 +98,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max)
        
        /* get data to filter, from Action or Dopesheet */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* set large values to try to override */
        *min= 999999999.0f;
@@ -211,7 +211,7 @@ static int actkeys_viewall_exec(bContext *C, wmOperator *op)
        /* do View2D syncing */
        UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
        
-       /* set notifier tha things have changed */
+       /* set notifier that things have changed */
        ED_area_tag_redraw(CTX_wm_area(C));
        
        return OPERATOR_FINISHED;
@@ -286,7 +286,7 @@ static short copy_action_keys (bAnimContext *ac)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_IPOKEYS);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* assume that each of these is an ipo-block */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -385,7 +385,7 @@ static short paste_action_keys (bAnimContext *ac)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* from selected channels */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -584,7 +584,7 @@ static void delete_action_keys (bAnimContext *ac)
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
        else
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop through filtered data and delete selected keys */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -644,7 +644,7 @@ static void clean_action_keys (bAnimContext *ac, float thresh)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop through filtered data and clean curves */
        for (ale= anim_data.first; ale; ale= ale->next)
@@ -716,7 +716,7 @@ static void sample_action_keys (bAnimContext *ac)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop through filtered data and add keys between selected keyframes on every frame  */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -843,7 +843,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop through setting mode per F-Curve */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -921,7 +921,7 @@ static void setipo_action_keys(bAnimContext *ac, short mode)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop through setting BezTriple interpolation
         * Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here...
@@ -1001,7 +1001,7 @@ static void sethandles_action_keys(bAnimContext *ac, short mode)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* loop through setting flags for handles 
         * Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here...
@@ -1116,7 +1116,7 @@ static int actkeys_cfrasnap_exec(bContext *C, wmOperator *op)
        
        /* loop over action data, averaging values */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
+       ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
        
        for (ale= anim_data.first; ale; ale= ale->next)
                ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL);
@@ -1175,7 +1175,7 @@ static void snap_action_keys(bAnimContext *ac, short mode)
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
        else
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* get beztriple editing callbacks */
        edit_cb= ANIM_editkeyframes_snap(mode);
@@ -1296,7 +1296,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
        else
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* mirror keyframes */
        for (ale= anim_data.first; ale; ale= ale->next) {
index 30449ed0c3047cd9c775b1b3d9ec13b7163d5c8c..2e8b34742b044e0ac322bf7b58a725b3cf155d73 100644 (file)
@@ -1539,7 +1539,7 @@ static void do_action_buttons(bContext *C, void *arg, int event)
 {
        switch(event) {
                case B_REDR:
-                       ED_region_tag_redraw(CTX_wm_region(C));
+                       ED_area_tag_redraw(CTX_wm_area(C));
                        break;
                        
                case B_ACTCOPYKEYS:
index 9b121bfb2705180f42c1205708aae807c62b009e..2e07b2db4171aca4743a354c9c8350ba061d9c73 100644 (file)
@@ -117,7 +117,7 @@ static void *get_nearest_action_key (bAnimContext *ac, int mval[2], float *selx,
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* get channel */
        ale= BLI_findlink(&anim_data, channel_index);
@@ -266,7 +266,7 @@ static void deselect_action_keys (bAnimContext *ac, short test, short sel)
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
        
        /* filter data */
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* init BezTriple looping data */
        memset(&bed, 0, sizeof(BeztEditData));
@@ -378,7 +378,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* get beztriple editing/validation funcs  */
        select_cb= ANIM_editkeyframes_select(selectmode);
@@ -559,7 +559,7 @@ static void markers_selectkeys_between (bAnimContext *ac)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* select keys in-between */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -615,14 +615,14 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
                case ACTKEYS_COLUMNSEL_KEYS: /* list of selected keys */
                        if (ac->datatype == ANIMCONT_GPENCIL) {
                                filter= (ANIMFILTER_VISIBLE);
-                               ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+                               ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
                                
                                //for (ale= anim_data.first; ale; ale= ale->next)
                                //      gplayer_make_cfra_list(ale->data, &elems, 1);
                        }
                        else {
                                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
-                               ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+                               ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
                                
                                for (ale= anim_data.first; ale; ale= ale->next)
                                        ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_to_cfraelem, NULL);
@@ -659,7 +659,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
                filter= (ANIMFILTER_VISIBLE);
        else
                        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        for (ale= anim_data.first; ale; ale= ale->next) {
                Object *nob= ANIM_nla_mapping_get(ac, ale);
@@ -927,7 +927,7 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec
                filter= (ANIMFILTER_VISIBLE);
        else
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
                
        /* select keys on the side where most data occurs */
        for (ale= anim_data.first; ale; ale= ale->next) {
@@ -972,7 +972,7 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx)
                filter= (ANIMFILTER_VISIBLE);
        else
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+       ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        for (ale= anim_data.first; ale; ale= ale->next) {
                Object *nob= ANIM_nla_mapping_get(ac, ale);
index 351a129fc7457c37c42ece32d710705a0b4272d4..728e44b53ef463ccf0123d22e8b63c9955b5d0c5 100644 (file)
@@ -2841,7 +2841,7 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act)
        
        /* filter data */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, act, ANIMCONT_ACTION);
+       ANIM_animdata_filter(ac, &anim_data, filter, act, ANIMCONT_ACTION);
        
        /* loop through relevant data, removing keyframes from the ipo-blocks that were attached 
         *      - all keyframes are converted in/out of global time 
@@ -3054,7 +3054,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
        else
                filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-       ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
+       ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
                
        /* which side of the current frame should be allowed */
        if (t->mode == TFM_TIME_EXTEND) {
@@ -4130,7 +4130,7 @@ void special_aftertrans_update(TransInfo *t)
                        short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
                        
                        /* get channels to work on */
-                       ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
+                       ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
                        
                        /* these should all be ipo-blocks */
                        for (ale= anim_data.first; ale; ale= ale->next) {