diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-01-30 11:10:31 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-01-30 11:10:31 +0300 |
commit | 59caae4384ccb02184e73d31e4ff739cb51efc82 (patch) | |
tree | 3bb6e5b5f7f0db4d43405b03c92058e82c4d4e89 /source | |
parent | e7d62464b708d95117da92b441c956d1611ffb79 (diff) |
Animato:
* Drivers view in Graph Editor now displays drivers only, instead of displaying normal Animation data.
* 'Materials' channel is now only shown under an Object when there are Materials with animation data...
* Hid more debug prints behind debug flag. These should be removed...
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 16 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels.c | 11 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 236 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ipo_utils.c | 5 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_ipo/ipo_draw.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_ipo/space_ipo.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_anim_types.h | 3 |
10 files changed, 238 insertions, 60 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c4ea53add4b..5c8bec3af6f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1886,6 +1886,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL); /* Get the appropriate information from the action */ + // XXX probably we might need some special filtering methods to make this more efficient if (cob->type == CONSTRAINT_OBTYPE_BONE) { Object workob; bPose *pose; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 47488f8debc..8c36f2b0017 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -20,6 +20,7 @@ #include "BKE_fcurve.h" #include "BKE_curve.h" +#include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_utildefines.h" @@ -489,6 +490,7 @@ static float driver_get_driver_value (ChannelDriver *driver, short target) /* error check for missing pointer... */ if (id == NULL) { printf("Error: driver doesn't have any valid target to use \n"); + if (G.f & G_DEBUG) printf("\tpath = %s [%d] \n", path, index); driver->flag |= DRIVER_FLAG_INVALID; return 0.0f; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 86fd846ea4f..595ba37e09c 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -646,7 +646,7 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode if(key->from==NULL) return; - printf("do_rel_key() \n"); + if (G.f & G_DEBUG) printf("do_rel_key() \n"); if( GS(key->from->name)==ID_ME ) { ofs[0]= sizeof(MVert); @@ -683,14 +683,14 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode if(kb!=key->refkey) { float icuval= kb->curval; - printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval); + if (G.f & G_DEBUG) printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval); /* only with value, and no difference allowed */ if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) { KeyBlock *refb; float weight, *weights= kb->weights; - printf("\t\tnot skipped \n"); + if (G.f & G_DEBUG) printf("\t\tnot skipped \n"); poin= basispoin; from= kb->data; @@ -762,7 +762,7 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock * if(key->from==0) return; - printf("do_key() \n"); + if (G.f & G_DEBUG) printf("do_key() \n"); if( GS(key->from->name)==ID_ME ) { ofs[0]= sizeof(MVert); @@ -1024,10 +1024,10 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me) /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */ me->key->from= (ID *)me; - printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2); + if (G.f & G_DEBUG) printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2); if(me->key->slurph && me->key->type!=KEY_RELATIVE ) { - printf("\tslurph key\n"); + if (G.f & G_DEBUG) printf("\tslurph key\n"); delta= me->key->slurph; delta/= me->totvert; @@ -1071,7 +1071,7 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me) if(me->key->type==KEY_RELATIVE) { KeyBlock *kb; - printf("\tdo relative \n"); + if (G.f & G_DEBUG) printf("\tdo relative \n"); for(kb= me->key->block.first; kb; kb= kb->next) kb->weights= get_weights_array(ob, kb->vgroup); @@ -1084,7 +1084,7 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me) } } else { - printf("\tdo absolute \n"); + if (G.f & G_DEBUG) printf("\tdo absolute \n"); ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0f); // xxx old cruft diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c index b7310e61934..006ffc0c641 100644 --- a/source/blender/editors/animation/anim_channels.c +++ b/source/blender/editors/animation/anim_channels.c @@ -1028,6 +1028,12 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s act->flag ^= ACT_COLLAPSED; } break; + case ANIMTYPE_FILLDRIVERS: + { + AnimData *adt= (AnimData* )ale->data; + adt->flag ^= ADT_DRIVERS_COLLAPSED; + } + break; case ANIMTYPE_FILLMATD: { Object *ob= (Object *)ale->data; @@ -1126,6 +1132,11 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s else { /* select/deselect */ fcu->flag ^= FCURVE_SELECTED; + + if (fcu->flag & FCURVE_SELECTED) + fcu->flag |= FCURVE_ACTIVE; + else + fcu->flag &= ~FCURVE_ACTIVE; } } break; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index e20511971be..8b14b9b2d5c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -221,7 +221,7 @@ static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo) sipo->ads->source= (ID *)ac->scene; sipo->ads->filterflag |= ADS_FILTER_ONLYDRIVERS; - ac->datatype= ANIMCONT_FCURVES; + ac->datatype= ANIMCONT_DRIVERS; ac->data= sipo->ads; ac->mode= sipo->mode; @@ -306,6 +306,9 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) /* quick macro to test if AnimData is usable */ #define ANIMDATA_HAS_KEYS(id) ((id)->adt && (id)->adt->action) +/* quick macro to test if AnimData is usable for drivers */ +#define ANIMDATA_HAS_DRIVERS(id) ((id)->adt && (id)->adt->drivers.first) + /* ----------- 'Private' Stuff --------------- */ /* this function allocates memory for a new bAnimListElem struct for the @@ -351,6 +354,17 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->datatype= ALE_ACT; } break; + case ANIMTYPE_FILLDRIVERS: + { + AnimData *adt= (AnimData *)data; + + ale->flag= adt->flag; + + // XXX... drivers don't show summary for now + ale->key_data= NULL; + ale->datatype= ALE_NONE; + } + break; case ANIMTYPE_FILLMATD: { Object *ob= (Object *)data; @@ -694,9 +708,29 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode) { + ListBase mats = {NULL, NULL}; + LinkData *ld; + bAnimListElem *ale=NULL; Object *ob= base->object; - int items = 0; + int items=0, a=0; + + /* firstly check that we actuallly have some materials, by gathering all materials in a temp list */ + for (a=0; a < ob->totcol; a++) { + Material *ma= give_current_material(ob, a); + + /* for now, if no material returned, skip (this shouldn't confuse the user I hope) */ + if (ELEM3(NULL, ma, ma->adt, ma->adt->action)) continue; + + /* make a temp list elem for this */ + ld= MEM_callocN(sizeof(LinkData), "DopeSheet-MaterialCache"); + ld->data= ma; + BLI_addtail(&mats, ld); + } + + /* if there were no channels found, no need to carry on */ + if (mats.first == NULL) + return 0; /* include materials-expand widget? */ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) { @@ -709,14 +743,9 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, /* add materials? */ if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_CURVESONLY)) { - short a; - - /* for each material, either add channels separately, or as ipo-block */ - for (a=0; a<ob->totcol; a++) { - Material *ma= give_current_material(ob, a); - - /* for now, if no material returned, skip (this shouldn't confuse the user I hope) */ - if (ELEM3(NULL, ma, ma->adt, ma->adt->action)) continue; + /* for each material in cache, add channels */ + for (ld= mats.first; ld; ld= ld->next) { + Material *ma= (Material *)ld->data; /* include material-expand widget? */ // hmm... do we need to store the index of this material in the array anywhere? @@ -728,7 +757,7 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, } } - /* add material's ipo-curve channels? */ + /* add material's F-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 @@ -737,6 +766,9 @@ static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, } } + /* free cache */ + BLI_freelistN(&mats); + /* return the number of items added to the list */ return items; } @@ -746,6 +778,7 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad bAnimListElem *ale=NULL; Object *ob= base->object; IdAdtTemplate *iat= ob->data; + AnimData *adt= iat->adt; short type=0, expanded=0; int items= 0; @@ -777,6 +810,10 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad 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) { ale= make_new_animlistelem(iat, type, base, ANIMTYPE_OBJECT, (ID *)iat); @@ -785,8 +822,15 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad /* 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); + /* Action or Drivers? */ + if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) { + // 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); + } + else { + // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?) + items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, iat, type, filter_mode, (ID *)iat); + } } /* return the number of items added to the list */ @@ -817,40 +861,88 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) ) return items; - /* Action? */ - if (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/) { - AnimData *adt= ob->adt; - - /* include action-expand widget? */ - if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) { - ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT, (ID *)ob); - if (ale) { - BLI_addtail(anim_data, ale); - items++; + /* Action or Drivers */ + if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) { + /* Action? */ + if (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/) { + AnimData *adt= ob->adt; + + /* include action-expand widget? */ + if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) { + ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT, (ID *)ob); + if (ale) { + BLI_addtail(anim_data, ale); + items++; + } + } + + /* 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, (ID *)ob); } } - - /* 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, (ID *)ob); + } + else { + /* Drivers */ + if (ANIMDATA_HAS_DRIVERS(ob)) { + AnimData *adt= ob->adt; + + /* include drivers-expand widget? */ + if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) { + ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLDRIVERS, base, ANIMTYPE_OBJECT, (ID *)ob); + if (ale) { + BLI_addtail(anim_data, ale); + items++; + } + } + + /* add F-Curve channels (drivers are F-Curves) */ + if (EXPANDED_DRVD(adt) || !(filter_mode & ANIMFILTER_CHANNELS)) { + // need to make the ownertype normal object here... (maybe type should be a separate one for clarity?) + items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, ob, ANIMTYPE_OBJECT, filter_mode, (ID *)ob); + } } } /* 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, (ID *)ob); - if (ale) { - BLI_addtail(anim_data, ale); - items++; + /* Animation or Drivers */ + if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) { + /* include shapekey-expand widget? */ + if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) { + ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT, (ID *)ob); + if (ale) { + BLI_addtail(anim_data, ale); + items++; + } + } + + /* add channels */ + if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) { + items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob); } } - - /* add channels */ - if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) { - items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob); + else { + /* Drivers */ + if (ANIMDATA_HAS_DRIVERS(key)) { + AnimData *adt= key->adt; + + /* include shapekey-expand widget? */ + if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) { + ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT, (ID *)ob); + if (ale) { + BLI_addtail(anim_data, ale); + items++; + } + } + + /* add F-Curve channels (drivers are F-Curves) */ + if (FILTER_SKE_OBJD(key)/*EXPANDED_DRVD(adt)*/ || !(filter_mode & ANIMFILTER_CHANNELS)) { + // XXX owner info is messed up now... + items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, ob, ANIMTYPE_OBJECT, filter_mode, (ID *)key); + } + } } } @@ -864,22 +956,49 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B case OB_CAMERA: /* ------- Camera ------------ */ { Camera *ca= (Camera *)ob->data; - if (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM)) - items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + + if ((ads->filterflag & ADS_FILTER_NOCAM) == 0) { + if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS)==0) { + if (ANIMDATA_HAS_KEYS(ca)) + items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + } + else { + if (ANIMDATA_HAS_DRIVERS(ca)) + items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + } + } } break; case OB_LAMP: /* ---------- Lamp ----------- */ { Lamp *la= (Lamp *)ob->data; - if (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM)) - items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + + if ((ads->filterflag & ADS_FILTER_NOLAM) == 0) { + if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS)==0) { + if (ANIMDATA_HAS_KEYS(la)) + items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + } + else { + if (ANIMDATA_HAS_DRIVERS(la)) + items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + } + } } break; case OB_CURVE: /* ------- Curve ---------- */ { Curve *cu= (Curve *)ob->data; - if (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR)) - items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + + if ((ads->filterflag & ADS_FILTER_NOCUR) == 0) { + if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS)==0) { + if (ANIMDATA_HAS_KEYS(cu)) + items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + } + else { + if (ANIMDATA_HAS_DRIVERS(cu)) + items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); + } + } } break; } @@ -942,26 +1061,41 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int #endif /* check filters for datatypes */ - actOk= (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/); - keyOk= ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)); + 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) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/); + keyOk= ((key) && ANIMDATA_HAS_KEYS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)); + } switch (ob->type) { case OB_CAMERA: /* ------- Camera ------------ */ { Camera *ca= (Camera *)ob->data; - dataOk= (ANIMDATA_HAS_KEYS(ca) && !(ads->filterflag & ADS_FILTER_NOCAM)); + 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)); } break; case OB_LAMP: /* ---------- Lamp ----------- */ { Lamp *la= (Lamp *)ob->data; - dataOk= (ANIMDATA_HAS_KEYS(la) && !(ads->filterflag & ADS_FILTER_NOLAM)); + 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)); } break; case OB_CURVE: /* -------- Curve ---------- */ { Curve *cu= (Curve *)ob->data; - dataOk= (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR)); + if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) + dataOk= (ANIMDATA_HAS_DRIVERS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR)); + else + dataOk= (ANIMDATA_HAS_KEYS(cu) && !(ads->filterflag & ADS_FILTER_NOCUR)); } break; default: /* --- other --- */ @@ -988,13 +1122,13 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int case OB_LAMP: /* ---------- Lamp ----------- */ { Lamp *la= (Lamp *)ob->data; - dataOk= ANIMDATA_HAS_KEYS(la); + dataOk= ANIMDATA_HAS_KEYS(la); } break; case OB_CURVE: /* -------- Curve ---------- */ { Curve *cu= (Curve *)ob->data; - dataOk= ANIMDATA_HAS_KEYS(cu); + dataOk= ANIMDATA_HAS_KEYS(cu); } break; default: /* --- other --- */ diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 631ca1e27b1..8de1531629b 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -138,6 +138,7 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu) /* Property Name is straightforward */ propname= (char *)RNA_property_ui_name(&ptr, prop); + /* Array Index - only if applicable */ if (RNA_property_array_length(&ptr, prop)) { // XXX the format of these is not final... we don't know how this will go yet static char *vectoritem[4]= {".X", ".Y", ".Z", ".W"}; @@ -160,6 +161,10 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu) arrayname= &arrayindbuf[0]; } } + else { + /* no array index */ + arrayname= ""; + } /* putting this all together into the buffer */ // XXX we need to check for invalid names... diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 7620c4f1331..ee9f0a5bb6e 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -112,6 +112,7 @@ typedef enum eAnim_ChannelType { ANIMTYPE_FCURVE, ANIMTYPE_FILLACTD, + ANIMTYPE_FILLDRIVERS, ANIMTYPE_FILLMATD, ANIMTYPE_DSMAT, @@ -171,6 +172,8 @@ typedef enum eAnimFilter_Flags { /* 'Sub-object/Action' channels (flags stored in Action) */ #define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED)) #define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0) + /* 'Sub-AnimData' chanenls */ +#define EXPANDED_DRVD(adt) ((adt->flag & ADT_DRIVERS_COLLAPSED)==0) /* Actions (also used for Dopesheet) */ /* Action Channel Group */ diff --git a/source/blender/editors/space_ipo/ipo_draw.c b/source/blender/editors/space_ipo/ipo_draw.c index 4ebfa2cd0ef..e9566506059 100644 --- a/source/blender/editors/space_ipo/ipo_draw.c +++ b/source/blender/editors/space_ipo/ipo_draw.c @@ -749,6 +749,22 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) strcpy(name, "Action"); } break; + case ANIMTYPE_FILLDRIVERS: /* drivers widget */ + { + AnimData *adt= (AnimData *)ale->data; + + group = 4; + indent= 1; + special= ICON_IPO_DEHLT; + + if (EXPANDED_DRVD(adt)) + expand= ICON_TRIA_DOWN; + else + expand= ICON_TRIA_RIGHT; + + strcpy(name, "Drivers"); + } + break; case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */ { Object *ob = (Object *)ale->data; diff --git a/source/blender/editors/space_ipo/space_ipo.c b/source/blender/editors/space_ipo/space_ipo.c index fab9a42f405..387304bb02c 100644 --- a/source/blender/editors/space_ipo/space_ipo.c +++ b/source/blender/editors/space_ipo/space_ipo.c @@ -132,8 +132,11 @@ static void graph_free(SpaceLink *sl) /* spacetype; init callback */ static void graph_init(struct wmWindowManager *wm, ScrArea *sa) { - //SpaceIpo *si= (SpaceIpo *)sa->spacedata.first; + SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first; + /* init dopesheet data if non-existant (i.e. for old files) */ + if (sipo->ads == NULL) + sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); } static SpaceLink *graph_duplicate(SpaceLink *sl) diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index e89e91c90eb..a6e3e5f4afb 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -496,6 +496,9 @@ enum { ADT_NLA_EVAL_OFF = (1<<1), /* don't execute drivers */ ADT_DRIVERS_DISABLED = (1<<2), + + /* drivers expanded in UI */ + ADT_DRIVERS_COLLAPSED = (1<<10), } eAnimData_Flag; /* Animation Data recalculation settings (to be set by depsgraph) */ |