diff options
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 74 |
1 files changed, 49 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index baf6e4630ee..f06583a6ace 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -36,7 +36,6 @@ #include "MEM_guardedalloc.h" #include "DNA_curve_types.h" -#include "DNA_ipo_types.h" #include "DNA_key_types.h" #include "DNA_lattice_types.h" #include "DNA_mesh_types.h" @@ -48,7 +47,6 @@ #include "BKE_blender.h" #include "BKE_curve.h" #include "BKE_global.h" -#include "BKE_ipo.h" #include "BKE_key.h" #include "BKE_lattice.h" #include "BKE_library.h" @@ -67,6 +65,11 @@ #define KEY_BPOINT 1 #define KEY_BEZTRIPLE 2 + // old defines from DNA_ipo_types.h for data-type +#define IPO_FLOAT 4 +#define IPO_BEZTRIPLE 100 +#define IPO_BPOINT 101 + int slurph_opt= 1; @@ -74,8 +77,9 @@ void free_key(Key *key) { KeyBlock *kb; +#if 0 // XXX old animation system if(key->ipo) key->ipo->id.us--; - +#endif // XXX old animation system while( (kb= key->block.first) ) { @@ -110,6 +114,7 @@ Key *add_key(ID *id) /* common function */ key->type= KEY_NORMAL; key->from= id; + // XXX the code here uses some defines which will soon be depreceated... if( GS(id->name)==ID_ME) { el= key->elemstr; @@ -150,8 +155,10 @@ Key *copy_key(Key *key) keyn= copy_libblock(key); +#if 0 // XXX old animation system keyn->ipo= copy_ipo(key->ipo); - +#endif // XXX old animation system + BLI_duplicatelist(&keyn->block, &key->block); kb= key->block.first; @@ -179,11 +186,13 @@ void make_local_key(Key *key) key->id.lib= 0; new_id(0, (ID *)key, 0); + +#if 0 // XXX old animation system make_local_ipo(key->ipo); +#endif // XXX old animation system } -/* - * Sort shape keys and Ipo curves after a change. This assumes that at most +/* Sort shape keys and Ipo curves after a change. This assumes that at most * one key was moved, which is a valid assumption for the places it's * currently being called. */ @@ -191,30 +200,30 @@ void make_local_key(Key *key) void sort_keys(Key *key) { KeyBlock *kb; - short i, adrcode; - IpoCurve *icu = NULL; + //short i, adrcode; + //IpoCurve *icu = NULL; KeyBlock *kb2; /* locate the key which is out of position */ - for( kb= key->block.first; kb; kb= kb->next ) - if( kb->next && kb->pos > kb->next->pos ) + for (kb= key->block.first; kb; kb= kb->next) + if ((kb->next) && (kb->pos > kb->next->pos)) break; /* if we find a key, move it */ - if( kb ) { + if (kb) { kb = kb->next; /* next key is the out-of-order one */ BLI_remlink(&key->block, kb); - + /* find the right location and insert before */ - for( kb2=key->block.first; kb2; kb2= kb2->next ) { - if( kb2->pos > kb->pos ) { + for (kb2=key->block.first; kb2; kb2= kb2->next) { + if (kb2->pos > kb->pos) { BLI_insertlink(&key->block, kb2->prev, kb); break; } } - + /* if more than one Ipo curve, see if this key had a curve */ - +#if 0 // XXX old animation system if(key->ipo && key->ipo->curve.first != key->ipo->curve.last ) { for(icu= key->ipo->curve.first; icu; icu= icu->next) { /* if we find the curve, remove it and reinsert in the @@ -232,13 +241,13 @@ void sort_keys(Key *key) } } } - + /* kb points at the moved key, icu at the moved ipo (if it exists). * go back now and renumber adrcodes */ /* first new code */ adrcode = kb2->adrcode; - for( i = kb->adrcode - adrcode; i >= 0; --i, ++adrcode ) { + for (i = kb->adrcode - adrcode; i >= 0; i--, adrcode++) { /* if the next ipo curve matches the current key, renumber it */ if(icu && icu->adrcode == kb->adrcode ) { icu->adrcode = adrcode; @@ -248,6 +257,7 @@ void sort_keys(Key *key) kb->adrcode = adrcode; kb = kb->next; } +#endif // XXX old animation system } /* new rule; first key is refkey, this to match drawing channels... */ @@ -1021,11 +1031,13 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me) for(a=0; a<me->totvert; a+=step, cfra+= delta) { - ctime= bsystem_time(scene, 0, cfra, 0.0); + ctime= bsystem_time(scene, 0, cfra, 0.0); // xxx ugly cruft! +#if 0 // XXX old animation system if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); } +#endif // XXX old animation system flag= setkeys(ctime, &me->key->block, k, t, 0); if(flag==0) { @@ -1056,13 +1068,15 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me) } } else { - ctime= bsystem_time(scene, ob, scene->r.cfra, 0.0); - + ctime= bsystem_time(scene, ob, scene->r.cfra, 0.0); // xxx old cruft + +#if 0 // XXX old animation system if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); } - +#endif // XXX old animation system + flag= setkeys(ctime, &me->key->block, k, t, 0); if(flag==0) { do_key(0, me->totvert, me->totvert, (char *)me->mvert->co, me->key, k, t, 0); @@ -1175,12 +1189,13 @@ static int do_curve_key(Scene *scene, Curve *cu) cfra= scene->r.cfra; for(a=0; a<tot; a+=step, cfra+= delta) { - - ctime= bsystem_time(scene, 0, cfra, 0.0); + ctime= bsystem_time(scene, 0, cfra, 0.0); // XXX old cruft +#if 0 // XXX old animation system if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); } +#endif // XXX old animation system flag= setkeys(ctime, &cu->key->block, k, t, 0); if(flag==0) { @@ -1204,10 +1219,12 @@ static int do_curve_key(Scene *scene, Curve *cu) do_rel_cu_key(cu, ctime); } else { +#if 0 // XXX old animation system if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); } +#endif // XXX old animation system flag= setkeys(ctime, &cu->key->block, k, t, 0); @@ -1240,11 +1257,13 @@ static int do_latt_key(Scene *scene, Object *ob, Lattice *lt) for(a=0; a<tot; a++, cfra+= delta) { - ctime= bsystem_time(scene, 0, cfra, 0.0); + ctime= bsystem_time(scene, 0, cfra, 0.0); // XXX old cruft +#if 0 // XXX old animation system if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); } +#endif // XXX old animation system flag= setkeys(ctime, <->key->block, k, t, 0); if(flag==0) { @@ -1273,10 +1292,12 @@ static int do_latt_key(Scene *scene, Object *ob, Lattice *lt) } } else { +#if 0 // XXX old animation system if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); } +#endif // XXX old animation system flag= setkeys(ctime, <->key->block, k, t, 0); if(flag==0) { @@ -1338,12 +1359,15 @@ int do_ob_key(Scene *scene, Object *ob) return 1; } else { +#if 0 // XXX old animation system + // NOTE: this stuff was NEVER reliable at all... if(ob->ipoflag & OB_ACTION_KEY) do_all_object_actions(scene, ob); else { calc_ipo(key->ipo, bsystem_time(scene, ob, scene->r.cfra, 0.0)); execute_ipo((ID *)key, key->ipo); } +#endif // XXX old animation system if(ob->type==OB_MESH) return do_mesh_key(scene, ob, ob->data); else if(ob->type==OB_CURVE) return do_curve_key(scene, ob->data); |