/* Delete selected keyframes in given F-Curve */ void delete_fcurve_keys(FCurve *fcu) { int i; /* Delete selected BezTriples */ for (i=0; i < fcu->totvert; i++) { if (fcu->bezt[i].f2 & SELECT) { memmove(&fcu->bezt[i], &fcu->bezt[i+1], sizeof(BezTriple)*(fcu->totvert-i-1)); fcu->totvert--; i--; } } /* Free the array of BezTriples if there are not keyframes */ if (fcu->totvert == 0) { if (fcu->bezt) MEM_freeN(fcu->bezt); fcu->bezt= NULL; } #if 0 // XXX for now, we don't get rid of empty curves... /* Only delete if there isn't an ipo-driver still hanging around on an empty curve */ if ((icu->totvert==0) && (icu->driver==NULL)) { BLI_remlink(&ipo->curve, icu); free_ipo_curve(icu); } #endif }
static int ED_object_shape_key_remove(bContext *C, Object *ob) { Main *bmain= CTX_data_main(C); KeyBlock *kb, *rkb; Key *key; //IpoCurve *icu; key= ob_get_key(ob); if(key==NULL) return 0; kb= BLI_findlink(&key->block, ob->shapenr-1); if(kb) { for(rkb= key->block.first; rkb; rkb= rkb->next) if(rkb->relative == ob->shapenr-1) rkb->relative= 0; BLI_remlink(&key->block, kb); key->totkey--; if(key->refkey== kb) { key->refkey= key->block.first; if(key->refkey) { /* apply new basis key on original data */ switch(ob->type) { case OB_MESH: key_to_mesh(key->refkey, ob->data); break; case OB_CURVE: case OB_SURF: key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data)); break; case OB_LATTICE: key_to_latt(key->refkey, ob->data); break; } } } if(kb->data) MEM_freeN(kb->data); MEM_freeN(kb); for(kb= key->block.first; kb; kb= kb->next) if(kb->adrcode>=ob->shapenr) kb->adrcode--; #if 0 // XXX old animation system if(key->ipo) { for(icu= key->ipo->curve.first; icu; icu= icu->next) { if(icu->adrcode==ob->shapenr-1) { BLI_remlink(&key->ipo->curve, icu); free_ipo_curve(icu); break; } } for(icu= key->ipo->curve.first; icu; icu= icu->next) if(icu->adrcode>=ob->shapenr) icu->adrcode--; } #endif // XXX old animation system if(ob->shapenr>1) ob->shapenr--; } if(key->totkey==0) { if(GS(key->from->name)==ID_ME) ((Mesh *)key->from)->key= NULL; else if(GS(key->from->name)==ID_CU) ((Curve *)key->from)->key= NULL; else if(GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= NULL; free_libblock_us(&(bmain->key), key); } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); return 1; }