Cleanup and new features for vertex keys.

User doc: http://www.blender3d.org/cms/Shape_Keys.678.0.html

- The mixed use of "Vertex Key","Key" or "RVK" in Blender was a bit
confusing. Also a 'vertex key' assumes keys per vertex, which actually is
only a single key for the entire shape. The discussions on blender.org
forums all mentioned "Shape" or "Blend Shapes", which I think is an OK
name for a "Vertex Key" in the UI. :)

- Most work was code spaghetti cleanup. Doing shape-keys now nicely goes
via the depgraph and DerivedMesh. That then allows to have different
shapes per object, with the new "Pin" feature.
Objects now define what Shape is shown (ob->shapenr)

- Added a Shape Panel in the Edit buttons with the various options

- Fixed a lot of issues in the IpoWindow, with drawing the channels.
For example, deleting a key-line there caused the entire Relative option to
go wrong, same for moving the lines up/down.
Changing key-line order now reflects in order of channels. The active
Shape is drawn more clear now too.

- Noticed it doesnt work yet for curves/lattice. Need modifier advise!
This commit is contained in:
2005-09-26 15:34:21 +00:00
parent 9656e8be02
commit 43d2904037
32 changed files with 2105 additions and 2032 deletions

View File

@@ -59,6 +59,8 @@ void make_local_obipo(struct Ipo *ipo);
void make_local_matipo(struct Ipo *ipo); void make_local_matipo(struct Ipo *ipo);
void make_local_keyipo(struct Ipo *ipo); void make_local_keyipo(struct Ipo *ipo);
void make_local_ipo(struct Ipo *ipo); void make_local_ipo(struct Ipo *ipo);
struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
void calchandles_ipocurve(struct IpoCurve *icu); void calchandles_ipocurve(struct IpoCurve *icu);
void testhandles_ipocurve(struct IpoCurve *icu); void testhandles_ipocurve(struct IpoCurve *icu);
void sort_time_ipocurve(struct IpoCurve *icu); void sort_time_ipocurve(struct IpoCurve *icu);

View File

@@ -48,19 +48,17 @@ struct Key *add_key(struct ID *id);
struct Key *copy_key(struct Key *key); struct Key *copy_key(struct Key *key);
void make_local_key(struct Key *key); void make_local_key(struct Key *key);
void sort_keys(struct Key *key); void sort_keys(struct Key *key);
void set_four_ipo(float d, float *data, int type); void set_four_ipo(float d, float *data, int type);
void set_afgeleide_four_ipo(float d, float *data, int type); void set_afgeleide_four_ipo(float d, float *data, int type);
void cp_key(int start, int end, int tot, char *poin, struct Key *key, struct KeyBlock *k, int mode);
/* only exported to curve.c! */
void cp_cu_key(struct Curve *cu, struct KeyBlock *kb, int start, int end); void cp_cu_key(struct Curve *cu, struct KeyBlock *kb, int start, int end);
void do_mesh_key(struct Mesh *me);
void do_curve_key(struct Curve *cu);
void do_latt_key(struct Lattice *lt);
void do_ob_key(struct Object *ob);
void do_spec_key(struct Key *key);
void unlock_all_keys(void); int do_ob_key(struct Object *ob);
struct KeyBlock *key_get_active(struct Key *keyData); struct Key *ob_get_key(struct Object *ob);
struct KeyBlock *ob_get_keyblock(struct Object *ob);
#endif #endif

View File

@@ -1474,8 +1474,9 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedM
*final_r = NULL; *final_r = NULL;
if (useDeform) { if (useDeform) {
do_mesh_key(me); if(do_ob_key(ob)) /* shape key makes deform verts */
deformedVerts = mesh_getVertexCos(me, &numVerts);
/* Apply all leading deforming modifiers */ /* Apply all leading deforming modifiers */
for (; md; md=md->next) { for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type); ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -1601,7 +1602,7 @@ static vec3f *editmesh_getVertexCos(EditMesh *em, int *numVerts_r)
VECCOPY(cos[i], eve->co); VECCOPY(cos[i], eve->co);
} }
return cos; return (vec3f *)cos;
} }
static void editmesh_calc_modifiers(DerivedMesh **cage_r, DerivedMesh **final_r) static void editmesh_calc_modifiers(DerivedMesh **cage_r, DerivedMesh **final_r)

View File

@@ -60,6 +60,7 @@
#include "BKE_action.h" #include "BKE_action.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_mball.h" #include "BKE_mball.h"
#include "BKE_modifier.h" #include "BKE_modifier.h"
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
@@ -1437,7 +1438,12 @@ void DAG_scene_update_flags(Scene *sce, unsigned int lay)
switch(ob->type) { switch(ob->type) {
case OB_MESH: case OB_MESH:
me= ob->data; me= ob->data;
if(me->key) ob->recalc |= OB_RECALC_DATA; if(me->key) {
if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
ob->recalc |= OB_RECALC_DATA;
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
}
}
else if(ob->effect.first) { else if(ob->effect.first) {
Effect *eff= ob->effect.first; Effect *eff= ob->effect.first;
if(eff->type==EFF_WAVE) ob->recalc |= OB_RECALC_DATA; if(eff->type==EFF_WAVE) ob->recalc |= OB_RECALC_DATA;
@@ -1452,11 +1458,21 @@ void DAG_scene_update_flags(Scene *sce, unsigned int lay)
case OB_CURVE: case OB_CURVE:
case OB_SURF: case OB_SURF:
cu= ob->data; cu= ob->data;
if(cu->key) ob->recalc |= OB_RECALC_DATA; if(cu->key) {
if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
ob->recalc |= OB_RECALC_DATA;
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
}
}
break; break;
case OB_LATTICE: case OB_LATTICE:
lt= ob->data; lt= ob->data;
if(lt->key) ob->recalc |= OB_RECALC_DATA; if(lt->key) {
if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
ob->recalc |= OB_RECALC_DATA;
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
}
}
break; break;
case OB_MBALL: case OB_MBALL:
if(ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA; if(ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA;
@@ -1481,9 +1497,13 @@ void DAG_object_flush_update(Scene *sce, Object *ob, short flag)
if(flag & OB_RECALC_DATA) { if(flag & OB_RECALC_DATA) {
ID *id= ob->data; ID *id= ob->data;
if(id && id->us>1) { if(id && id->us>1) {
for (base= sce->base.first; base; base= base->next) { /* except when there's a key and shapes are locked */
if (ob->data==base->object->data) { if(ob_get_key(ob) && (ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)));
base->object->recalc |= OB_RECALC_DATA; else {
for (base= sce->base.first; base; base= base->next) {
if (ob->data==base->object->data) {
base->object->recalc |= OB_RECALC_DATA;
}
} }
} }
} }

View File

@@ -1446,6 +1446,11 @@ void curve_calc_modifiers_pre(Object *ob, ListBase *nurb, int forRender, float (
float (*originalVerts)[3] = NULL; float (*originalVerts)[3] = NULL;
float (*deformedVerts)[3] = NULL; float (*deformedVerts)[3] = NULL;
if(ob!=G.obedit && do_ob_key(ob)) {
deformedVerts = curve_getVertexCos(ob->data, nurb, &numVerts);
originalVerts = MEM_dupallocN(deformedVerts);
}
if (preTesselatePoint) { if (preTesselatePoint) {
for (; md; md=md->next) { for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type); ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -1522,7 +1527,6 @@ void makeDispListSurf(Object *ob, ListBase *dispbase, int forRender)
nubase= &editNurb; nubase= &editNurb;
} }
else { else {
do_curve_key(cu);
nubase= &cu->nurb; nubase= &cu->nurb;
} }
@@ -1606,7 +1610,6 @@ void makeDispListCurveTypes(Object *ob, int forOrco)
if(ob->type==OB_FONT) text_to_curve(ob, 0); if(ob->type==OB_FONT) text_to_curve(ob, 0);
if(!obedit && !forOrco) do_curve_key(cu);
if(!forOrco) curve_calc_modifiers_pre(ob, nubase, 0, &originalVerts, &deformedVerts, &numVerts); if(!forOrco) curve_calc_modifiers_pre(ob, nubase, 0, &originalVerts, &deformedVerts, &numVerts);
makeBevelList(ob); makeBevelList(ob);

View File

@@ -386,6 +386,17 @@ void make_local_ipo(Ipo *ipo)
} }
IpoCurve *find_ipocurve(Ipo *ipo, int adrcode)
{
if(ipo) {
IpoCurve *icu= ipo->curve.first;
while(icu) {
if(icu->adrcode==adrcode) return icu;
icu= icu->next;
}
}
return NULL;
}
void calchandles_ipocurve(IpoCurve *icu) void calchandles_ipocurve(IpoCurve *icu)
{ {

View File

@@ -38,27 +38,28 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "DNA_key_types.h" #include "DNA_curve_types.h"
#include "DNA_ipo_types.h" #include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h" #include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h" #include "DNA_meshdata_types.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_curve_types.h"
#include "DNA_lattice_types.h"
#include "BLI_blenlib.h"
#include "BKE_utildefines.h"
#include "BKE_bad_level_calls.h" #include "BKE_bad_level_calls.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BKE_blender.h" #include "BKE_blender.h"
#include "BKE_curve.h" #include "BKE_curve.h"
#include "BKE_object.h" #include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_key.h"
#include "BKE_ipo.h" #include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_lattice.h" #include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
@@ -191,23 +192,20 @@ void sort_keys(Key *key)
while(doit) { while(doit) {
doit= 0; doit= 0;
kb= key->block.first; for(kb= key->block.first; kb; kb= kb->next) {
while(kb) {
if(kb->next) { if(kb->next) {
if(kb->pos > kb->next->pos) { if(kb->pos > kb->next->pos) {
BLI_remlink(&key->block, kb); BLI_remlink(&key->block, kb);
/* insertlink(lb, prevlink, newlink): newlink komt na prevlink */
BLI_insertlink(&key->block, kb->next, kb); BLI_insertlink(&key->block, kb->next, kb);
doit= 1; doit= 1;
break; break;
} }
} }
kb= kb->next;
} }
} }
} }
/**************** do the key ****************/ /**************** do the key ****************/
@@ -407,7 +405,7 @@ static void flerp(int aantal, float *in, float *f0, float *f1, float *f2, float
} }
} }
void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *k, int mode) static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *k, int mode)
{ {
float ktot = 0.0, kd = 0.0; float ktot = 0.0, kd = 0.0;
int elemsize, poinsize = 0, a, *ofsp, ofs[32], flagflo=0; int elemsize, poinsize = 0, a, *ofsp, ofs[32], flagflo=0;
@@ -578,7 +576,6 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, f
{ {
KeyBlock *kb; KeyBlock *kb;
IpoCurve *icu; IpoCurve *icu;
float fac[KEY_TOTIPO], fval;
int *ofsp, ofs[3], elemsize, a, b; int *ofsp, ofs[3], elemsize, a, b;
char *cp, *poin, *reffrom, *from, elemstr[8]; char *cp, *poin, *reffrom, *from, elemstr[8];
@@ -611,30 +608,23 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, f
elemsize= key->elemsize; elemsize= key->elemsize;
if(mode==KEY_BEZTRIPLE) elemsize*= 3; if(mode==KEY_BEZTRIPLE) elemsize*= 3;
/* step one: fetch ipo values */ /* step 1 init */
icu= key->ipo->curve.first;
for(a=0; a<KEY_TOTIPO; a++) fac[a]= 0.0;
while(icu) {
fac[icu->adrcode]= icu->curval;
icu= icu->next;
}
/* step 2 init */
cp_key(start, end, tot, basispoin, key, key->refkey, mode); cp_key(start, end, tot, basispoin, key, key->refkey, mode);
/* step 3: do it */ /* step 2: do it */
a= 1; a= 1;
kb= key->block.first; kb= key->block.first;
while(kb) { while(kb) {
if(kb!=key->refkey) { if(kb!=key->refkey) {
fval= fac[a]; icu= find_ipocurve(key->ipo, kb->adrcode);
a++; a++;
if(a==32) break; if(a==64) break;
/* no difference allowed */ /* only with ipocurve, and no difference allowed */
if(kb->totelem==tot) { if(icu && kb->totelem==tot) {
poin= basispoin; poin= basispoin;
reffrom= key->refkey->data; reffrom= key->refkey->data;
@@ -655,16 +645,16 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, f
switch(cp[1]) { switch(cp[1]) {
case IPO_FLOAT: case IPO_FLOAT:
rel_flerp(cp[0], (float *)poin, (float *)reffrom, (float *)from, fval); rel_flerp(cp[0], (float *)poin, (float *)reffrom, (float *)from, icu->curval);
break; break;
case IPO_BPOINT: case IPO_BPOINT:
rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, fval); rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, icu->curval);
rel_flerp(1, (float *)(poin+16), (float *)(reffrom+16), (float *)(from+16), fval); rel_flerp(1, (float *)(poin+16), (float *)(reffrom+16), (float *)(from+16), icu->curval);
break; break;
case IPO_BEZTRIPLE: case IPO_BEZTRIPLE:
rel_flerp(9, (float *)poin, (float *)reffrom, (float *)from, fval); rel_flerp(9, (float *)poin, (float *)reffrom, (float *)from, icu->curval);
break; break;
} }
@@ -898,16 +888,15 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
} }
} }
void do_mesh_key(Mesh *me) static int do_mesh_key(Mesh *me)
{ {
KeyBlock *k[4]; KeyBlock *k[4];
float cfra, ctime, t[4], delta, loc[3], size[3]; float cfra, ctime, t[4], delta, loc[3], size[3];
int a, flag = 0, step; int a, flag = 0, step;
if(me->totvert==0) return; if(me->totvert==0) return 0;
if(me->key==NULL) return; if(me->key==NULL) return 0;
if(me->key->flag & KEY_LOCKED) return; if(me->key->block.first==NULL) return 0;
if(me->key->block.first==NULL) return;
if(me->key->slurph && me->key->type!=KEY_RELATIVE ) { if(me->key->slurph && me->key->type!=KEY_RELATIVE ) {
delta= me->key->slurph; delta= me->key->slurph;
@@ -969,6 +958,7 @@ void do_mesh_key(Mesh *me)
else boundbox_mesh(me, loc, size); else boundbox_mesh(me, loc, size);
} }
} }
return 1;
} }
static void do_cu_key(Curve *cu, KeyBlock **k, float *t) static void do_cu_key(Curve *cu, KeyBlock **k, float *t)
@@ -1042,7 +1032,7 @@ static void do_rel_cu_key(Curve *cu, float ctime)
} }
} }
void do_curve_key(Curve *cu) static int do_curve_key(Curve *cu)
{ {
KeyBlock *k[4]; KeyBlock *k[4];
float cfra, ctime, t[4], delta; float cfra, ctime, t[4], delta;
@@ -1050,10 +1040,9 @@ void do_curve_key(Curve *cu)
tot= count_curveverts(&cu->nurb); tot= count_curveverts(&cu->nurb);
if(tot==0) return; if(tot==0) return 0;
if(cu->key==NULL) return; if(cu->key==NULL) return 0;
if(cu->key->flag & KEY_LOCKED) return; if(cu->key->block.first==NULL) return 0;
if(cu->key->block.first==NULL) return;
if(cu->key->slurph) { if(cu->key->slurph) {
delta= cu->key->slurph; delta= cu->key->slurph;
@@ -1110,17 +1099,18 @@ void do_curve_key(Curve *cu)
if(flag && k[2]==cu->key->refkey) tex_space_curve(cu); if(flag && k[2]==cu->key->refkey) tex_space_curve(cu);
} }
} }
return 1;
} }
void do_latt_key(Lattice *lt) static int do_latt_key(Lattice *lt)
{ {
KeyBlock *k[4]; KeyBlock *k[4];
float delta, cfra, ctime, t[4]; float delta, cfra, ctime, t[4];
int a, tot, flag; int a, tot, flag;
if(lt->key==NULL) return; if(lt->key==NULL) return 0;
if(lt->key->flag & KEY_LOCKED) return; if(lt->key->block.first==NULL) return 0;
if(lt->key->block.first==0) return;
tot= lt->pntsu*lt->pntsv*lt->pntsw; tot= lt->pntsu*lt->pntsv*lt->pntsw;
@@ -1171,51 +1161,79 @@ void do_latt_key(Lattice *lt)
} }
if(lt->flag & LT_OUTSIDE) outside_lattice(lt); if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
return 1;
} }
/* returns 1 when key applied */
/* going to be removed */ int do_ob_key(Object *ob)
void unlock_all_keys()
{ {
Key *key; if(ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)) {
Key *key= ob_get_key(ob);
key= G.main->key.first; if(key) {
while(key) { KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
key->flag &= ~KEY_LOCKED;
key= key->id.next; if(kb==NULL) {
kb= key->block.first;
ob->shapenr= 1;
}
if(ob->type==OB_MESH) {
Mesh *me= ob->data;
cp_key(0, me->totvert, me->totvert, (char *)me->mvert->co, key, kb, 0);
}
else if(ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
int tot= lt->pntsu*lt->pntsv*lt->pntsw;
cp_key(0, tot, tot, (char *)lt->def->vec, key, kb, 0);
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
Curve *cu= ob->data;
int tot= count_curveverts(&cu->nurb);
cp_cu_key(cu, kb, 0, tot);
}
return 1;
}
} }
else {
if(ob->type==OB_MESH) return do_mesh_key( ob->data);
else if(ob->type==OB_CURVE) return do_curve_key( ob->data);
else if(ob->type==OB_SURF) return do_curve_key( ob->data);
else if(ob->type==OB_LATTICE) return do_latt_key( ob->data);
}
return 0;
} }
void do_ob_key(Object *ob) Key *ob_get_key(Object *ob)
{ {
if(ob->type==OB_MESH) do_mesh_key( ob->data);
else if(ob->type==OB_CURVE) do_curve_key( ob->data); if(ob->type==OB_MESH) {
else if(ob->type==OB_SURF) do_curve_key( ob->data); Mesh *me= ob->data;
else if(ob->type==OB_LATTICE) do_latt_key( ob->data); return me->key;
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
Curve *cu= ob->data;
return cu->key;
}
else if(ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
return lt->key;
}
return NULL;
} }
void do_spec_key(Key *key) /* only the active keyblock */
KeyBlock *ob_get_keyblock(Object *ob)
{ {
int idcode; Key *key= ob_get_key(ob);
if(key==0) return; if (key) {
KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
idcode= GS(key->from->name); return kb;
if(idcode==ID_ME) do_mesh_key( (Mesh *)key->from);
else if(idcode==ID_CU) do_curve_key( (Curve *)key->from);
else if(idcode==ID_LT) do_latt_key( (Lattice *)key->from);
}
KeyBlock *key_get_active(Key *keyData)
{
if (keyData) {
KeyBlock *key;
for (key=keyData->block.first; key; key= key->next)
if (key->flag&SELECT)
return key;
} }
return NULL; return NULL;

View File

@@ -707,7 +707,7 @@ void lattice_calc_modifiers(Object *ob)
freedisplist(&ob->disp); freedisplist(&ob->disp);
if (!editmode) { if (!editmode) {
do_latt_key(ob->data); do_ob_key(ob);
} }
for (; md; md=md->next) { for (; md; md=md->next) {

View File

@@ -436,6 +436,7 @@ void scene_select_base(Scene *sce, Base *selbase)
void scene_update_for_newframe(Scene *sce, unsigned int lay) void scene_update_for_newframe(Scene *sce, unsigned int lay)
{ {
Base *base; Base *base;
Object *ob;
int setcount=0; int setcount=0;
/* object ipos are calculated in where_is_object */ /* object ipos are calculated in where_is_object */
@@ -443,9 +444,6 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED); if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
/* if keys were activated, disable the locks */
unlock_all_keys();
/* for time being; sets otherwise can be cyclic */ /* for time being; sets otherwise can be cyclic */
while(sce && setcount<2) { while(sce && setcount<2) {
if(sce->theDag==NULL) if(sce->theDag==NULL)
@@ -454,11 +452,13 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
DAG_scene_update_flags(sce, lay); // only stuff that moves DAG_scene_update_flags(sce, lay); // only stuff that moves
for(base= sce->base.first; base; base= base->next) { for(base= sce->base.first; base; base= base->next) {
object_handle_update(base->object); // bke_object.h ob= base->object;
object_handle_update(ob); // bke_object.h
/* only update layer when an ipo */ /* only update layer when an ipo */
if(base->object->ipo && has_ipo_code(base->object->ipo, OB_LAY) ) { if(ob->ipo && has_ipo_code(ob->ipo, OB_LAY) ) {
base->lay= base->object->lay; base->lay= ob->lay;
} }
} }
sce= sce->set; sce= sce->set;

View File

@@ -4848,6 +4848,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob; Object *ob;
bArmature *arm; bArmature *arm;
Mesh *me; Mesh *me;
Key *key;
Scene *sce= main->scene.first; Scene *sce= main->scene.first;
while(sce){ while(sce){
@@ -4941,6 +4942,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
mesh_strip_loose_faces(me); mesh_strip_loose_faces(me);
} }
} }
for(key= main->key.first; key; key= key->id.next) {
KeyBlock *kb;
int index= 1;
/* trick to find out if we already introduced adrcode */
for(kb= key->block.first; kb; kb= kb->next)
if(kb->adrcode) break;
if(kb==NULL) {
for(kb= key->block.first; kb; kb= kb->next) {
if(kb==key->refkey) {
if(kb->name[0]==0)
strcpy(kb->name, "Basis");
}
else {
if(kb->name[0]==0)
sprintf(kb->name, "Key %d", index);
kb->adrcode= index++;
}
}
}
}
} }
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

View File

@@ -39,25 +39,27 @@ struct Mesh;
struct Object; struct Object;
struct Lattice; struct Lattice;
struct Curve; struct Curve;
struct uiBlock;
void mesh_to_key(struct Mesh *me, struct KeyBlock *kb); void mesh_to_key(struct Mesh *me, struct KeyBlock *kb);
void key_to_mesh(struct KeyBlock *kb, struct Mesh *me); void key_to_mesh(struct KeyBlock *kb, struct Mesh *me);
void insert_meshkey(struct Mesh *me, short offline); void insert_meshkey(struct Mesh *me, short rel);
void latt_to_key(struct Lattice *lt, struct KeyBlock *kb); void latt_to_key(struct Lattice *lt, struct KeyBlock *kb);
void key_to_latt(struct KeyBlock *kb, struct Lattice *lt); void key_to_latt(struct KeyBlock *kb, struct Lattice *lt);
void insert_lattkey(struct Lattice *lt); void insert_lattkey(struct Lattice *lt, short rel);
void curve_to_key(struct Curve *cu, struct KeyBlock *kb, ListBase *nurb); void curve_to_key(struct Curve *cu, struct KeyBlock *kb, ListBase *nurb);
void key_to_curve(struct KeyBlock *kb, struct Curve *cu, ListBase *nurb); void key_to_curve(struct KeyBlock *kb, struct Curve *cu, ListBase *nurb);
void insert_curvekey(struct Curve *cu); void insert_curvekey(struct Curve *cu, short rel);
struct Key *give_current_key(struct Object *ob); void insert_shapekey(struct Object *ob);
void showkeypos(struct Key *key, struct KeyBlock *kb);
void deselectall_key(void); void delete_key(struct Object *ob);
void delete_key(void); void move_keys(struct Object *ob);
void move_keys(void);
void make_rvk_slider(struct uiBlock *block, struct Key *key, int i,
int x, int y, int w, int h, char *tip);
#endif #endif

View File

@@ -54,8 +54,8 @@ typedef enum {
ICON_SPACE2, ICON_SPACE2,
ICON_SPACE3, ICON_SPACE3,
ICON_SPACE4, ICON_SPACE4,
ICON_SPACE5, ICON_TRIA_LEFT,
ICON_SPACE6, ICON_TRIA_UP,
ICON_ORTHO, ICON_ORTHO,
ICON_PERSP, ICON_PERSP,
@@ -76,8 +76,8 @@ typedef enum {
ICON_SORTSIZE, ICON_SORTSIZE,
ICON_LONGDISPLAY, ICON_LONGDISPLAY,
ICON_SHORTDISPLAY, ICON_SHORTDISPLAY,
ICON_TRIA_OPEN, ICON_TRIA_DOWN,
ICON_TRIA_CLOSED, ICON_TRIA_RIGHT,
ICON_VIEW_AXIS_ALL, ICON_VIEW_AXIS_ALL,
ICON_VIEW_AXIS_NONE, ICON_VIEW_AXIS_NONE,

View File

@@ -59,7 +59,7 @@ char *getname_key_ei(int nr);
char *getname_la_ei(int nr); char *getname_la_ei(int nr);
char *getname_cam_ei(int nr); char *getname_cam_ei(int nr);
char *getname_snd_ei(int nr); char *getname_snd_ei(int nr);
struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
void boundbox_ipocurve(struct IpoCurve *icu); void boundbox_ipocurve(struct IpoCurve *icu);
void boundbox_ipo(struct Ipo *ipo, struct rctf *bb); void boundbox_ipo(struct Ipo *ipo, struct rctf *bb);
void editipo_changed(struct SpaceIpo *si, int doredraw); void editipo_changed(struct SpaceIpo *si, int doredraw);

View File

@@ -325,9 +325,17 @@ enum {
#define B_DOCENTRENEW 2016 #define B_DOCENTRENEW 2016
#define B_DOCENTRECURSOR 2017 #define B_DOCENTRECURSOR 2017
/* 32 values! */ /* 20 values! */
#define B_OBLAY 2019 #define B_OBLAY 2019
#define B_ADDKEY 2041
#define B_SETKEY 2042
#define B_DELKEY 2043
#define B_NAMEKEY 2044
#define B_PREVKEY 2045
#define B_NEXTKEY 2046
#define B_LOCKKEY 2047
#define B_MESHBUTS 2100 #define B_MESHBUTS 2100
#define B_FLIPNORM 2050 #define B_FLIPNORM 2050
@@ -367,7 +375,6 @@ enum {
#define B_DRAWEDGES 2087 #define B_DRAWEDGES 2087
#define B_DRAWCREASES 2088 #define B_DRAWCREASES 2088
/* *********************** */ /* *********************** */
#define B_CURVEBUTS 2200 #define B_CURVEBUTS 2200

View File

@@ -43,8 +43,8 @@ typedef struct KeyBlock {
struct KeyBlock *next, *prev; struct KeyBlock *next, *prev;
float pos; float pos;
short flag, pad; int pad;
short type, rt; short type, adrcode;
int totelem; int totelem;
void *data; void *data;
@@ -77,8 +77,8 @@ typedef struct Key {
/* key->type */ /* key->type */
#define KEY_NORMAL 0 #define KEY_NORMAL 0
#define KEY_RELATIVE 1 #define KEY_RELATIVE 1
/* key->flag */ /* key->flag */
#define KEY_LOCKED 1
/* keyblock->type */ /* keyblock->type */
#define KEY_LINEAR 0 #define KEY_LINEAR 0

View File

@@ -190,10 +190,10 @@ typedef struct Object {
LBuf lbuf; LBuf lbuf;
LBuf port; LBuf port;
float pad3, smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */ short fluidsimFlag; /* NT toggle fluidsim participation on/off */
char shapenr, shapeflag; /* current shape key for menu or pinned, flag for pinning */
float smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
short fluidsimFlag; /* NT toggle fluidsim participation on/off */
short dnapadFluidsimDummy1, dnapadFluidsimDummy2, dnapadFluidsimDummy3; /* 8byte align */
struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */ struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
struct DerivedMesh *derivedDeform, *derivedFinal; struct DerivedMesh *derivedDeform, *derivedFinal;
@@ -375,6 +375,11 @@ extern Object workob;
#define OB_ADDACT 1024 #define OB_ADDACT 1024
#define OB_SHOWCONT 2048 #define OB_SHOWCONT 2048
/* ob->shapeflag */
#define OB_SHAPE_LOCK 1
#define OB_SHAPE_TEMPLOCK 2
/* ob->softflag in DNA_object_force.h */ /* ob->softflag in DNA_object_force.h */
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -757,8 +757,8 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args )
// return (EXPP_ReturnPyObjError (PyExc_RuntimeError, // return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
// "frame value has to be greater than 0")); // "frame value has to be greater than 0"));
//insert a keybock for the lattice //insert a keybock for the lattice (1=relative)
insert_lattkey( lt ); insert_lattkey( lt , 1);
if( frame > 0 ) if( frame > 0 )
G.scene->r.cfra = (short)oldfra; G.scene->r.cfra = (short)oldfra;

File diff suppressed because it is too large Load Diff

View File

@@ -73,9 +73,10 @@
#include "DNA_world_types.h" #include "DNA_world_types.h"
#include "DNA_packedFile_types.h" #include "DNA_packedFile_types.h"
#include "BKE_curve.h"
#include "BKE_depsgraph.h" #include "BKE_depsgraph.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_curve.h" #include "BKE_key.h"
#include "BKE_library.h" #include "BKE_library.h"
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_modifier.h" #include "BKE_modifier.h"
@@ -95,6 +96,7 @@
#include "BIF_editconstraint.h" #include "BIF_editconstraint.h"
#include "BIF_editdeform.h" #include "BIF_editdeform.h"
#include "BIF_editfont.h" #include "BIF_editfont.h"
#include "BIF_editkey.h"
#include "BIF_editmesh.h" #include "BIF_editmesh.h"
#include "BIF_interface.h" #include "BIF_interface.h"
#include "BIF_meshtools.h" #include "BIF_meshtools.h"
@@ -366,7 +368,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
EditMesh *em = G.editMesh; EditMesh *em = G.editMesh;
EditFace *efa; EditFace *efa;
Base *base; Base *base;
Object *ob; Object *ob= OBACT;
Nurb *nu; Nurb *nu;
Curve *cu; Curve *cu;
BezTriple *bezt; BezTriple *bezt;
@@ -411,7 +413,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
} }
break; break;
case B_MATNEW: case B_MATNEW:
new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0); new_material_to_objectdata(ob);
scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea);
BIF_undo_push("New material"); BIF_undo_push("New material");
allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWBUTSSHADING, 0);
@@ -528,7 +530,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
} }
break; break;
case B_AUTOTEX: case B_AUTOTEX:
ob= OBACT;
if(ob && G.obedit==0) { if(ob && G.obedit==0) {
if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) tex_space_curve(ob->data); if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) tex_space_curve(ob->data);
} }
@@ -596,10 +597,54 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
break; break;
case B_CHANGEDEP: case B_CHANGEDEP:
DAG_scene_sort(G.scene); // makes new dag DAG_scene_sort(G.scene); // makes new dag
ob= OBACT;
if(ob) ob->recalc |= OB_RECALC; if(ob) ob->recalc |= OB_RECALC;
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
break; break;
case B_ADDKEY:
insert_shapekey(ob);
break;
case B_SETKEY:
ob->shapeflag |= OB_SHAPE_TEMPLOCK;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWBUTSEDIT, 0);
break;
case B_LOCKKEY:
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWBUTSEDIT, 0);
break;
case B_NEXTKEY:
{
Key *key= ob_get_key(ob);
if(ob->shapenr == BLI_countlist(&key->block))
ob->shapenr= 1;
else ob->shapenr++;
do_common_editbuts(B_SETKEY);
break;
}
case B_PREVKEY:
{
Key *key= ob_get_key(ob);
if(ob->shapenr <= 1)
ob->shapenr= BLI_countlist(&key->block);
else ob->shapenr--;
do_common_editbuts(B_SETKEY);
break;
}
case B_NAMEKEY:
allspace(REMAKEIPO, 0);
allqueue (REDRAWIPO, 0);
break;
case B_DELKEY:
delete_key(OBACT);
break;
default: default:
if(event>=B_OBLAY && event<=B_OBLAY+31) { if(event>=B_OBLAY && event<=B_OBLAY+31) {
local= BASACT->lay & 0xFF000000; local= BASACT->lay & 0xFF000000;
@@ -611,11 +656,11 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
} }
BASACT->lay += local; BASACT->lay += local;
/* optimal redraw */ /* optimal redraw */
if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) ); if( (ob->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 ); else if( (ob->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
else allqueue(REDRAWVIEW3D, 0); else allqueue(REDRAWVIEW3D, 0);
OBACT->lay= BASACT->lay; ob->lay= BASACT->lay;
} }
} }
@@ -1360,6 +1405,71 @@ static void editing_panel_modifiers(Object *ob)
if(yco < 0) uiNewPanelHeight(block, 204-yco); if(yco < 0) uiNewPanelHeight(block, 204-yco);
} }
static char *make_key_menu(Key *key)
{
KeyBlock *kb;
int index= 1;
char *str, item[64];
for (kb = key->block.first; kb; kb=kb->next, index++);
str= MEM_mallocN(index*40, "key string");
str[0]= 0;
index= 1;
for (kb = key->block.first; kb; kb=kb->next, index++) {
sprintf (item, "|%s%%x%d", kb->name, index);
strcat(str, item);
}
return str;
}
static void editing_panel_shapes(Object *ob)
{
uiBlock *block;
Key *key= NULL;
KeyBlock *kb;
int icon;
char *strp;
block= uiNewBlock(&curarea->uiblocks, "editing_panel_shapes", UI_EMBOSS, UI_HELV, curarea->win);
uiNewPanelTabbed("Modifiers", "Editing");
if( uiNewPanel(curarea, block, "Shapes", "Editing", 640, 0, 318, 204)==0) return;
uiDefBut(block, BUT, B_ADDKEY, "Add Shape Key" , 10, 180, 150, 20, NULL, 0.0, 0.0, 0, 0, "Add new Shape Key");
key= ob_get_key(ob);
if(key==NULL)
return;
uiDefButS(block, TOG, B_RELKEY, "Relative", 170, 180,140,20, &key->type, 0, 0, 0, 0, "Makes Shape Keys relative");
kb= BLI_findlink(&key->block, ob->shapenr-1);
if(kb==NULL) {
ob->shapenr= 1;
kb= key->block.first;
}
uiBlockBeginAlign(block);
if(ob->shapeflag & OB_SHAPE_LOCK) icon= ICON_PIN_HLT; else icon= ICON_PIN_DEHLT;
uiDefIconButBitC(block, TOG, OB_SHAPE_LOCK, B_LOCKKEY, icon, 10,150,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object");
uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 35,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key");
strp= make_key_menu(key);
uiDefButC(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browses existing choices or adds NEW");
MEM_freeN(strp);
uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 75,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key");
uiDefBut(block, TEX, B_NAMEKEY, "", 95, 150, 190, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name");
uiDefIconBut(block, BUT, B_DELKEY, ICON_X, 285,150,25,20, 0, 0, 0, 0, 0, "Deletes current Shape Key");
uiBlockEndAlign(block);
if(key->type && (ob->shapeflag & OB_SHAPE_LOCK)==0 && ob->shapenr!=1) {
uiBlockBeginAlign(block);
make_rvk_slider(block, key, ob->shapenr-1, 10, 120, 150, 20, "Key value, when used it inserts an animation curve point");
uiDefButF(block, NUM, B_REDR, "Min ", 160,120, 75, 20, &kb->slidermin, -10.0, 10.0, 100, 1, "Minumum for slider");
uiDefButF(block, NUM, B_REDR, "Max ", 235,120, 75, 20, &kb->slidermax, -10.0, 10.0, 100, 1, "Maximum for slider");
}
}
/* *************************** FONT ******************************** */ /* *************************** FONT ******************************** */
static short give_vfontnr(VFont *vfont) static short give_vfontnr(VFont *vfont)
@@ -3616,13 +3726,14 @@ void editing_panels()
switch(ob->type) { switch(ob->type) {
case OB_MESH: case OB_MESH:
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
editing_panel_mesh_type(ob, ob->data); // no editmode! editing_panel_mesh_type(ob, ob->data);
editing_panel_modifiers(ob); editing_panel_modifiers(ob);
editing_panel_shapes(ob);
/* modes */ /* modes */
if(G.obedit) { if(G.obedit) {
editing_panel_mesh_tools(ob, ob->data); // no editmode! editing_panel_mesh_tools(ob, ob->data);
editing_panel_mesh_tools1(ob, ob->data); // no editmode! editing_panel_mesh_tools1(ob, ob->data);
} }
else { else {
if(G.f & G_FACESELECT) { if(G.f & G_FACESELECT) {
@@ -3638,9 +3749,10 @@ void editing_panels()
case OB_CURVE: case OB_CURVE:
case OB_SURF: case OB_SURF:
cu= ob->data; cu= ob->data;
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
editing_panel_curve_type(ob, cu); editing_panel_curve_type(ob, cu);
editing_panel_modifiers(ob); editing_panel_modifiers(ob);
// editing_panel_shapes(ob);
if(G.obedit) { if(G.obedit) {
editing_panel_curve_tools(ob, cu); editing_panel_curve_tools(ob, cu);
editing_panel_curve_tools1(ob, cu); editing_panel_curve_tools1(ob, cu);
@@ -3649,7 +3761,7 @@ void editing_panels()
case OB_MBALL: case OB_MBALL:
mb= ob->data; mb= ob->data;
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
editing_panel_mball_type(ob, mb); editing_panel_mball_type(ob, mb);
if(G.obedit) { if(G.obedit) {
editing_panel_mball_tools(ob, mb); editing_panel_mball_tools(ob, mb);
@@ -3658,7 +3770,7 @@ void editing_panels()
case OB_FONT: case OB_FONT:
cu= ob->data; cu= ob->data;
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
editing_panel_curve_type(ob, cu); editing_panel_curve_type(ob, cu);
editing_panel_font_type(ob, cu); editing_panel_font_type(ob, cu);
@@ -3673,17 +3785,18 @@ void editing_panels()
case OB_LATTICE: case OB_LATTICE:
lt= ob->data; lt= ob->data;
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
editing_panel_lattice_type(ob, lt); editing_panel_lattice_type(ob, lt);
editing_panel_modifiers(ob); editing_panel_modifiers(ob);
// editing_panel_shapes(ob);
break; break;
case OB_LAMP: case OB_LAMP:
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
break; break;
case OB_EMPTY: case OB_EMPTY:
editing_panel_links(ob); // no editmode! editing_panel_links(ob);
break; break;
case OB_CAMERA: case OB_CAMERA:

View File

@@ -65,6 +65,7 @@
/* Everything from source (BIF, BDR, BSE) ------------------------------ */ /* Everything from source (BIF, BDR, BSE) ------------------------------ */
#include "BIF_editaction.h" #include "BIF_editaction.h"
#include "BIF_editkey.h"
#include "BIF_interface.h" #include "BIF_interface.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_glutil.h" #include "BIF_glutil.h"
@@ -104,8 +105,6 @@ void do_actionbuts(unsigned short event);
/* implementation ------------------------------------------------------ */ /* implementation ------------------------------------------------------ */
extern void make_rvk_slider(uiBlock *block, Key *key, int i,
int x, int y, int w, int h); /* editkey.c */
extern short showsliders; /* editaction .c */ extern short showsliders; /* editaction .c */
extern short ACTWIDTH; extern short ACTWIDTH;
@@ -177,7 +176,7 @@ void meshactionbuts(SpaceAction *saction, Key *key)
uiBlockSetEmboss(block, UI_EMBOSS); uiBlockSetEmboss(block, UI_EMBOSS);
for (i=1 ; i < key->totkey ; ++ i) { for (i=1 ; i < key->totkey ; ++ i) {
make_rvk_slider(block, key, i, make_rvk_slider(block, key, i,
x, y, SLIDERWIDTH-2, CHANNELHEIGHT-1); x, y, SLIDERWIDTH-2, CHANNELHEIGHT-1, "Slider to control Shape Keys");
y-=CHANNELHEIGHT+CHANNELSKIP; y-=CHANNELHEIGHT+CHANNELSKIP;

View File

@@ -59,11 +59,12 @@
#include "DNA_sequence_types.h" #include "DNA_sequence_types.h"
#include "DNA_userdef_types.h" #include "DNA_userdef_types.h"
#include "BKE_utildefines.h"
#include "BKE_curve.h" #include "BKE_curve.h"
#include "BKE_ipo.h" #include "BKE_depsgraph.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_ipo.h"
#include "BKE_key.h" #include "BKE_key.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_resources.h" #include "BIF_resources.h"
@@ -858,6 +859,7 @@ static void draw_ipobuts(SpaceIpo *sipo)
{ {
ScrArea *area= sipo->area; ScrArea *area= sipo->area;
View2D *v2d= &sipo->v2d; View2D *v2d= &sipo->v2d;
Object *ob= OBACT;
uiBlock *block; uiBlock *block;
uiBut *but; uiBut *but;
EditIpo *ei; EditIpo *ei;
@@ -885,6 +887,15 @@ static void draw_ipobuts(SpaceIpo *sipo)
ei= sipo->editipo; ei= sipo->editipo;
y= area->winy-30+sipo->butofs; y= area->winy-30+sipo->butofs;
if(sipo->blocktype==ID_KE) {
int icon;
if(ob->shapeflag & OB_SHAPE_LOCK) icon= ICON_PIN_HLT; else icon= ICON_PIN_DEHLT;
uiDefIconButBitC(block, TOG, OB_SHAPE_LOCK, B_SETKEY, icon,
v2d->mask.xmax+18,y,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object");
y-= IPOBUTY;
}
for(a=0; a<sipo->totipo; a++, ei++, y-=IPOBUTY) { for(a=0; a<sipo->totipo; a++, ei++, y-=IPOBUTY) {
// this button defines visiblity, bit zero of flag (IPO_VISIBLE) // this button defines visiblity, bit zero of flag (IPO_VISIBLE)
but= uiDefButBitS(block, TOG, IPO_VISIBLE, a+1, ei->name, v2d->mask.xmax+18, y, IPOBUTX-15, IPOBUTY-1, &(ei->flag), 0, 0, 0, 0, ""); but= uiDefButBitS(block, TOG, IPO_VISIBLE, a+1, ei->name, v2d->mask.xmax+18, y, IPOBUTX-15, IPOBUTY-1, &(ei->flag), 0, 0, 0, 0, "");
@@ -903,7 +914,11 @@ static void draw_ipobuts(SpaceIpo *sipo)
if(sipo->blocktype==ID_KE) { if(sipo->blocktype==ID_KE) {
Key *key= (Key *)sipo->from; Key *key= (Key *)sipo->from;
if(key==0 || key->type==KEY_NORMAL) break; if(key==NULL || key->type==KEY_NORMAL) break;
if(a==ob->shapenr-1) {
cpack(0x0);
fdrawbox(v2d->mask.xmax+7, y+1, v2d->mask.xmax+16, y+IPOBUTY-1);
}
} }
} }
uiDrawBlock(block); uiDrawBlock(block);
@@ -1370,16 +1385,17 @@ static void draw_key(SpaceIpo *sipo, int visible)
View2D *v2d= &sipo->v2d; View2D *v2d= &sipo->v2d;
Key *key; Key *key;
KeyBlock *kb, *act=NULL; KeyBlock *kb, *act=NULL;
Object *ob= OBACT;
unsigned int col; unsigned int col;
int index;
key= (Key *)sipo->from; key= (Key *)sipo->from;
if(key==0) if(key==NULL)
return; return;
if(key->type== KEY_RELATIVE) if(visible==0) return; if(key->type== KEY_RELATIVE) if(visible==0) return;
kb= key->block.first; for(index=1, kb= key->block.first; kb; kb= kb->next, index++) {
while(kb) {
if(kb->type==KEY_LINEAR) setlinestyle(2); if(kb->type==KEY_LINEAR) setlinestyle(2);
else if(kb->type==KEY_BSPLINE) setlinestyle(4); else if(kb->type==KEY_BSPLINE) setlinestyle(4);
else setlinestyle(0); else setlinestyle(0);
@@ -1387,7 +1403,7 @@ static void draw_key(SpaceIpo *sipo, int visible)
if(kb==key->refkey) col= 0x22FFFF; if(kb==key->refkey) col= 0x22FFFF;
else col= 0xFFFF00; else col= 0xFFFF00;
if( (kb->flag & SELECT)==0) col-= 0x225500; if(ob->shapenr!=index) col-= 0x225500;
else act= kb; else act= kb;
cpack(col); cpack(col);
@@ -1397,7 +1413,6 @@ static void draw_key(SpaceIpo *sipo, int visible)
glVertex2f(v2d->cur.xmax, kb->pos); glVertex2f(v2d->cur.xmax, kb->pos);
glEnd(); glEnd();
kb= kb->next;
} }
if(act) { if(act) {
@@ -1470,6 +1485,7 @@ static void boundbox_ipo_visible(SpaceIpo *si)
/* is used for both read and write... */ /* is used for both read and write... */
static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float max) static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float max)
{ {
Object *ob= OBACT;
EditIpo *ei; EditIpo *ei;
BezTriple *bezt; BezTriple *bezt;
float median[3]; float median[3];
@@ -1519,14 +1535,9 @@ static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float m
if(key==0) return; if(key==0) return;
iskey= 1; iskey= 1;
kb= key->block.first; kb= BLI_findlink(&key->block, ob->shapenr-1);
while(kb) { median[1]+= kb->pos;
if(kb->flag & SELECT) { tot++;
median[1]+= kb->pos;
tot++;
}
kb= kb->next;
}
} }
} }
if(tot==0) return; if(tot==0) return;
@@ -1563,16 +1574,12 @@ static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float m
Key *key= (Key *)G.sipo->from; Key *key= (Key *)G.sipo->from;
KeyBlock *kb; KeyBlock *kb;
if(key==0) return; if(key==NULL) return;
kb= key->block.first; kb= BLI_findlink(&key->block, ob->shapenr-1);
while(kb) { kb->pos+= median[1];
if(kb->flag & SELECT) { tot++;
kb->pos+= median[1];
tot++;
}
kb= kb->next;
}
sort_keys(key); sort_keys(key);
} }
} }
@@ -1616,7 +1623,8 @@ static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float m
void do_ipobuts(unsigned short event) void do_ipobuts(unsigned short event)
{ {
Object *ob= OBACT;
switch(event) { switch(event) {
case B_SETSPEED: case B_SETSPEED:
set_speed_editipo(hspeed); set_speed_editipo(hspeed);
@@ -1630,6 +1638,13 @@ void do_ipobuts(unsigned short event)
editipo_changed(G.sipo, 1); editipo_changed(G.sipo, 1);
allqueue(REDRAWIPO, 0); allqueue(REDRAWIPO, 0);
break; break;
case B_SETKEY:
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWBUTSEDIT, 0);
break;
} }
} }
@@ -1730,7 +1745,6 @@ void drawipospace(ScrArea *sa, void *spacedata)
test_editipo(); /* test if current editipo is correct, make_editipo sets v2d->cur */ test_editipo(); /* test if current editipo is correct, make_editipo sets v2d->cur */
myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax); myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
if(sipo->editipo) { if(sipo->editipo) {

View File

@@ -1774,9 +1774,14 @@ static void draw_mesh_object(Base *base, int dt)
{ {
Object *ob= base->object; Object *ob= base->object;
Mesh *me= ob->data; Mesh *me= ob->data;
int has_alpha= 0; int has_alpha= 0, drawlinked= 0;
if(G.obedit && ob->data==G.obedit->data) { if(G.obedit && ob!=G.obedit && ob->data==G.obedit->data) {
if(ob_get_key(ob));
else drawlinked= 1;
}
if(ob==G.obedit || drawlinked) {
int cageNeedsFree, finalNeedsFree; int cageNeedsFree, finalNeedsFree;
DerivedMesh *finalDM, *cageDM; DerivedMesh *finalDM, *cageDM;

View File

@@ -288,8 +288,9 @@ static void remake_meshaction_ipos(Ipo *ipo)
static void meshkey_do_redraw(Key *key) static void meshkey_do_redraw(Key *key)
{ {
remake_meshaction_ipos(key->ipo); remake_meshaction_ipos(key->ipo);
do_spec_key(key);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
allspace(REMAKEIPO, 0); allspace(REMAKEIPO, 0);
allqueue(REDRAWACTION, 0); allqueue(REDRAWACTION, 0);
allqueue(REDRAWIPO, 0); allqueue(REDRAWIPO, 0);
@@ -2356,7 +2357,8 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
} }
Key *get_action_mesh_key(void) { Key *get_action_mesh_key(void)
{
/* gets the key data from the currently selected /* gets the key data from the currently selected
* mesh/lattice. If a mesh is not selected, or does not have * mesh/lattice. If a mesh is not selected, or does not have
* key data, then we return NULL (currently only * key data, then we return NULL (currently only

View File

@@ -237,7 +237,7 @@ void load_editNurb()
cu= G.obedit->data; cu= G.obedit->data;
/* are there keys? */ /* are there keys? */
actkey = key_get_active(cu->key); actkey = ob_get_keyblock(G.obedit);
if(actkey) { if(actkey) {
/* active key: the vertices */ /* active key: the vertices */
@@ -299,7 +299,7 @@ void make_editNurb()
nu= nu->next; nu= nu->next;
} }
actkey = key_get_active(cu->key); actkey = ob_get_keyblock(G.obedit);
if(actkey) { if(actkey) {
strcpy(G.editModeTitleExtra, "(Key) "); strcpy(G.editModeTitleExtra, "(Key) ");
key_to_curve(actkey, cu, &editNurb); key_to_curve(actkey, cu, &editNurb);

View File

@@ -185,7 +185,8 @@ char *ac_ic_names[AC_TOTNAM] = {"LocX", "LocY", "LocZ", "SizeX", "SizeY",
"SizeZ", "QuatW", "QuatX", "QuatY", "QuatZ"}; "SizeZ", "QuatW", "QuatX", "QuatY", "QuatZ"};
char *ic_name_empty[1] ={ "" }; char *ic_name_empty[1] ={ "" };
char *getname_ac_ei(int nr) { char *getname_ac_ei(int nr)
{
switch(nr) { switch(nr) {
case AC_LOC_X: case AC_LOC_X:
case AC_LOC_Y: case AC_LOC_Y:
@@ -294,18 +295,6 @@ char *getname_snd_ei(int nr)
return ic_name_empty[0]; return ic_name_empty[0];
} }
IpoCurve *find_ipocurve(Ipo *ipo, int adrcode)
{
if(ipo) {
IpoCurve *icu= ipo->curve.first;
while(icu) {
if(icu->adrcode==adrcode) return icu;
icu= icu->next;
}
}
return NULL;
}
void boundbox_ipocurve(IpoCurve *icu) void boundbox_ipocurve(IpoCurve *icu)
{ {
BezTriple *bezt; BezTriple *bezt;
@@ -490,7 +479,6 @@ void editipo_changed(SpaceIpo *si, int doredraw)
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
} }
else if(si->blocktype==ID_KE) { else if(si->blocktype==ID_KE) {
do_spec_key((Key *)si->from);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
} }
@@ -613,7 +601,7 @@ Ipo *get_ipo_to_edit(ID **from)
} }
else if(G.sipo->blocktype==ID_KE) { else if(G.sipo->blocktype==ID_KE) {
if(ob) { if(ob) {
Key *key= give_current_key(ob); Key *key= ob_get_key(ob);
*from= (ID *)key; *from= (ID *)key;
if(key) return key->ipo; if(key) return key->ipo;
} }
@@ -657,14 +645,16 @@ unsigned int ipo_rainbow(int cur, int tot)
dfac= (float)(1.0/( (float)tot+1.0)); dfac= (float)(1.0/( (float)tot+1.0));
/* this calculation makes 2 different cycles of rainbow colors */ /* this calculation makes 2 or 4 different cycles of rainbow colors */
if(cur< tot/2) fac= (float)(cur*2.0*dfac); if(cur< tot/2) fac= (float)(cur*2.0f*dfac);
else fac= (float)((cur-tot/2)*2.0*dfac +dfac); else fac= (float)((cur-tot/2)*2.0f*dfac +dfac);
if(tot > 32) fac= fac*1.95f;
if(fac>1.0f) fac-= 1.0f;
if(fac>0.5 && fac<0.8) sat= (float)0.4; if(fac>0.5f && fac<0.8f) sat= 0.4f;
else sat= 0.5; else sat= 0.5f;
return hsv_to_cpack(fac, sat, 1.0); return hsv_to_cpack(fac, sat, 1.0f);
} }
void make_ob_editipo(Object *ob, SpaceIpo *si) void make_ob_editipo(Object *ob, SpaceIpo *si)
@@ -774,20 +764,30 @@ void make_key_editipo(SpaceIpo *si)
int a; int a;
char *name; char *name;
ei= si->editipo= MEM_callocN(KEY_TOTIPO*sizeof(EditIpo), "editipo");
si->totipo= KEY_TOTIPO;
key= (Key *)G.sipo->from; key= (Key *)G.sipo->from;
if(key) kb= key->block.first; if(key==NULL) return;
for(a=0; a<KEY_TOTIPO; a++, ei++) { si->totipo= BLI_countlist(&key->block);
if(kb && kb->name[0] != 0) strncpy(ei->name, kb->name, 32); // length both same ei= si->editipo= MEM_callocN(si->totipo*sizeof(EditIpo), "editipo");
for(a=0; a<si->totipo; a++, ei++) {
/* we put refkey first, the rest in order of list */
if(a==0) kb= key->refkey;
else { else {
name = getname_key_ei(key_ar[a]); if(a==1)
kb= key->block.first;
else
kb= kb->next;
if(kb==key->refkey)
kb= kb->next;
}
if(kb->name[0] != 0) strncpy(ei->name, kb->name, 31); // length both same
else {
name = getname_key_ei(kb->adrcode);
strcpy(ei->name, name); strcpy(ei->name, name);
} }
ei->adrcode= key_ar[a]; ei->adrcode= kb->adrcode;
ei->col= ipo_rainbow(a, KEY_TOTIPO); ei->col= ipo_rainbow(a, KEY_TOTIPO);
@@ -796,8 +796,6 @@ void make_key_editipo(SpaceIpo *si)
ei->flag= ei->icu->flag; ei->flag= ei->icu->flag;
} }
else if(a==0) ei->flag |= IPO_VISIBLE; else if(a==0) ei->flag |= IPO_VISIBLE;
if(kb) kb= kb->next;
} }
ei= si->editipo; ei= si->editipo;
@@ -1088,7 +1086,7 @@ void make_editipo()
if(G.sipo->editipo) if(G.sipo->editipo)
MEM_freeN(G.sipo->editipo); MEM_freeN(G.sipo->editipo);
G.sipo->editipo= 0; G.sipo->editipo= NULL;
G.sipo->totipo= 0; G.sipo->totipo= 0;
ob= OBACT; ob= OBACT;
@@ -1412,8 +1410,6 @@ void swap_selectall_editipo()
BezTriple *bezt; BezTriple *bezt;
int a, b; /* , sel=0; */ int a, b; /* , sel=0; */
deselectall_key();
get_status_editipo(); get_status_editipo();
if(G.sipo->showkey) { if(G.sipo->showkey) {
@@ -1514,8 +1510,6 @@ void deselectall_editipo()
BezTriple *bezt; BezTriple *bezt;
int a, b; /* , sel=0; */ int a, b; /* , sel=0; */
deselectall_key();
get_status_editipo(); get_status_editipo();
if(G.sipo->showkey) { if(G.sipo->showkey) {
@@ -2455,12 +2449,12 @@ void ipo_snap(short event)
void mouse_select_ipo() void mouse_select_ipo()
{ {
Object *ob; Object *ob;
Key *key;
KeyBlock *kb, *actkb=NULL, *curkb;
EditIpo *ei, *actei= 0; EditIpo *ei, *actei= 0;
IpoCurve *icu; IpoCurve *icu;
IpoKey *ik, *actik; IpoKey *ik, *actik;
BezTriple *bezt; BezTriple *bezt;
Key *key;
KeyBlock *kb, *actkb=0;
float x, y, dist, mindist; float x, y, dist, mindist;
int a, oldflag = 0, hand, ok; int a, oldflag = 0, hand, ok;
short mval[2], xo, yo; short mval[2], xo, yo;
@@ -2539,9 +2533,12 @@ void mouse_select_ipo()
else { else {
/* vertex keys ? */ /* vertex keys ? */
if(G.sipo->blocktype==ID_KE && G.sipo->from) { if(G.sipo->blocktype==ID_KE && G.sipo->from) {
int i, index= 1;
key= (Key *)G.sipo->from; key= (Key *)G.sipo->from;
ob= OBACT;
curkb= BLI_findlink(&key->block, ob->shapenr-1);
ei= G.sipo->editipo; ei= G.sipo->editipo;
if(key->type==KEY_NORMAL || (ei->flag & IPO_VISIBLE)) { if(key->type==KEY_NORMAL || (ei->flag & IPO_VISIBLE)) {
@@ -2551,36 +2548,38 @@ void mouse_select_ipo()
/* how much is 20 pixels? */ /* how much is 20 pixels? */
mindist= (float)(20.0*(G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)curarea->winy); mindist= (float)(20.0*(G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)curarea->winy);
kb= key->block.first; for(i=1, kb= key->block.first; kb; kb= kb->next, i++) {
while(kb) {
dist= (float)(fabs(kb->pos-y)); dist= (float)(fabs(kb->pos-y));
if(kb->flag & SELECT) dist+= (float)0.01; if(kb==curkb) dist+= (float)0.01;
if(dist < mindist) { if(dist < mindist) {
actkb= kb; actkb= kb;
mindist= dist; mindist= dist;
index= i;
} }
kb= kb->next;
} }
if(actkb) { if(actkb) {
ok= TRUE; ok= TRUE;
if(G.obedit && (actkb->flag & 1)==0) { if(G.obedit && actkb!=curkb) {
ok= okee("Copy key after leaving Edit Mode"); ok= okee("Copy key after leaving Edit Mode");
} }
if(ok) { if(ok) {
/* also does all keypos */ /* also does all keypos */
deselectall_editipo(); deselectall_editipo();
actkb->flag |= 1; ob->shapenr= index;
ob->shapeflag |= OB_SHAPE_TEMPLOCK;
/* calc keypos */ /* calc keypos */
showkeypos((Key *)G.sipo->from, actkb); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
} }
} }
} }
} }
/* select curve */ /* select curve */
if(actkb==0) { if(actkb==NULL) {
if(totipo_vis==1) { if(totipo_vis==1) {
ei= G.sipo->editipo; ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
@@ -2628,7 +2627,7 @@ void mouse_select_ipo()
getmouseco_areawin(mval); getmouseco_areawin(mval);
if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) { if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
if(actkb) move_keys(); if(actkb) move_keys(OBACT);
else transform_ipo('g'); else transform_ipo('g');
return; return;
@@ -3049,8 +3048,6 @@ void setipotype_ipo(Ipo *ipo, int code)
void set_ipotype() void set_ipotype()
{ {
EditIpo *ei; EditIpo *ei;
Key *key;
KeyBlock *kb;
int a; int a;
short event; short event;
@@ -3059,22 +3056,20 @@ void set_ipotype()
get_status_editipo(); get_status_editipo();
if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0) { if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0) {
key= (Key *)G.sipo->from; Key *key= (Key *)G.sipo->from;
if(key==0) return; Object *ob= OBACT;
KeyBlock *kb;
if(key==NULL) return;
kb= BLI_findlink(&key->block, ob->shapenr-1);
event= pupmenu("Key Type %t|Linear %x1|Cardinal %x2|B Spline %x3"); event= pupmenu("Key Type %t|Linear %x1|Cardinal %x2|B Spline %x3");
if(event < 1) return; if(event < 1) return;
kb= key->block.first; kb->type= 0;
while(kb) { if(event==1) kb->type= KEY_LINEAR;
if(kb->flag & SELECT) { if(event==2) kb->type= KEY_CARDINAL;
kb->type= 0; if(event==3) kb->type= KEY_BSPLINE;
if(event==1) kb->type= KEY_LINEAR;
if(event==2) kb->type= KEY_CARDINAL;
if(event==3) kb->type= KEY_BSPLINE;
}
kb= kb->next;
}
} }
else { else {
event= pupmenu("Ipo Type %t|Constant %x1|Linear %x2|Bezier %x3"); event= pupmenu("Ipo Type %t|Constant %x1|Linear %x2|Bezier %x3");
@@ -3190,7 +3185,8 @@ void del_ipo()
if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
if(totipo_edit==0 && totipo_sel==0 && totipo_vertsel==0) { if(totipo_edit==0 && totipo_sel==0 && totipo_vertsel==0) {
delete_key(); if(okee("Erase selected keys"))
delete_key(OBACT);
return; return;
} }
@@ -3914,15 +3910,7 @@ void common_insertkey()
if(event== -1) return; if(event== -1) return;
if(event==7) { // ob != NULL if(event==7) { // ob != NULL
if(ob->type==OB_MESH) insert_meshkey(ob->data, 0); insert_shapekey(ob);
else if ELEM(ob->type, OB_CURVE, OB_SURF) insert_curvekey(ob->data);
else if(ob->type==OB_LATTICE) insert_lattkey(ob->data);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWBUTSEDIT, 0);
return; return;
} }
@@ -4761,7 +4749,7 @@ void transform_ipo(int mode)
} }
if(tot==0) { if(tot==0) {
if(totipo_edit==0) move_keys(); if(totipo_edit==0) move_keys(OBACT);
return; return;
} }

View File

@@ -31,16 +31,14 @@
*/ */
#include <math.h> #include <math.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
#else #else
#include <io.h> #include <io.h>
#endif #endif
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
@@ -88,10 +86,6 @@
extern ListBase editNurb; /* in editcurve.c */ extern ListBase editNurb; /* in editcurve.c */
/* local prototypes ------------------ */
void make_rvk_slider(uiBlock *, Key *, int , int , int , int , int ); /* used in drawaction.c too */
/* temporary storage for slider values */ /* temporary storage for slider values */
float meshslidervals[64] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, float meshslidervals[64] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
@@ -157,13 +151,14 @@ static void rvk_slider_func(void *voidkey, void *voidkeynum)
*/ */
IpoCurve *icu=NULL; IpoCurve *icu=NULL;
BezTriple *bezt=NULL; BezTriple *bezt=NULL;
Key *key = (Key *) voidkey; Key *key = (Key *) voidkey;
float cfra, rvkval; Object *ob= OBACT;
int *keynum = (int *) voidkeynum; float cfra, rvkval;
int keynum = (int) voidkeynum;
cfra = frame_to_float(CFRA); cfra = frame_to_float(CFRA);
icu = get_key_icu(key, *keynum); icu = get_key_icu(key, keynum);
if (icu) { if (icu) {
/* if the ipocurve exists, try to get a bezier /* if the ipocurve exists, try to get a bezier
@@ -175,18 +170,17 @@ static void rvk_slider_func(void *voidkey, void *voidkeynum)
/* create an IpoCurve if one doesn't already /* create an IpoCurve if one doesn't already
* exist. * exist.
*/ */
icu = get_ipocurve(key->from, GS(key->from->name), icu = get_ipocurve(key->from, GS(key->from->name), keynum, key->ipo);
*keynum, key->ipo);
} }
/* create the bezier triple if one doesn't exist, /* create the bezier triple if one doesn't exist,
* otherwise modify it's value * otherwise modify it's value
*/ */
if (!bezt) { if (!bezt) {
insert_vert_ipo(icu, cfra, meshslidervals[*keynum]); insert_vert_ipo(icu, cfra, meshslidervals[keynum]);
} }
else { else {
bezt->vec[1][1] = meshslidervals[*keynum]; bezt->vec[1][1] = meshslidervals[keynum];
} }
/* make sure the Ipo's are properly process and /* make sure the Ipo's are properly process and
@@ -195,11 +189,10 @@ static void rvk_slider_func(void *voidkey, void *voidkeynum)
sort_time_ipocurve(icu); sort_time_ipocurve(icu);
testhandles_ipocurve(icu); testhandles_ipocurve(icu);
key->flag &= ~KEY_LOCKED;
do_ipo(key->ipo); do_ipo(key->ipo);
do_spec_key(key);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWACTION, 0); allqueue (REDRAWACTION, 0);
@@ -208,7 +201,8 @@ static void rvk_slider_func(void *voidkey, void *voidkeynum)
} }
static float getrvkval(Key *key, int keynum) { static float getrvkval(Key *key, int keynum)
{
/* get the value of the rvk from the /* get the value of the rvk from the
* ipo curve at the current time -- return 0 * ipo curve at the current time -- return 0
* if no ipo curve exists * if no ipo curve exists
@@ -232,27 +226,15 @@ static float getrvkval(Key *key, int keynum) {
} }
void make_rvk_slider(uiBlock *block, Key *key, int keynum, void make_rvk_slider(uiBlock *block, Key *key, int keynum,
int x, int y, int w, int h) int x, int y, int w, int h, char *tip)
{ {
/* create a slider for the rvk */ /* create a slider for the rvk */
uiBut *but; uiBut *but;
KeyBlock *kb; KeyBlock *kb;
float min, max; float min, max;
int i; int i;
/* dang, need to pass a pointer to int to uiButSetFunc /* global array */
* that is on the heap, not the stack ... hence this
* kludgy static array
*/
static int keynums[] = {0,1,2,3,4,5,6,7,
8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,
48,49,50,51,52,53,54,55,
56,57,58,59,60,61,62,63};
meshslidervals[keynum] = getrvkval(key, keynum); meshslidervals[keynum] = getrvkval(key, keynum);
kb= key->block.first; kb= key->block.first;
@@ -271,9 +253,9 @@ void make_rvk_slider(uiBlock *block, Key *key, int keynum,
but=uiDefButF(block, NUMSLI, REDRAWVIEW3D, "", but=uiDefButF(block, NUMSLI, REDRAWVIEW3D, "",
x, y , w, h, x, y , w, h,
meshslidervals+keynum, min, max, 10, 2, meshslidervals+keynum, min, max, 10, 2, tip);
"Slider to control rvk");
uiButSetFunc(but, rvk_slider_func, key, keynums+keynum); uiButSetFunc(but, rvk_slider_func, key, (void *)keynum);
// no hilite, the winmatrix is not correct later on... // no hilite, the winmatrix is not correct later on...
uiButSetFlag(but, UI_NO_HILITE); uiButSetFlag(but, UI_NO_HILITE);
@@ -352,60 +334,57 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
} }
} }
static KeyBlock *add_keyblock(Key *key)
void insert_meshkey(Mesh *me, short offline)
{ {
Key *key; KeyBlock *kb;
KeyBlock *kb, *kkb; float curpos= -0.1;
float curpos; int tot;
short rel;
kb= key->block.last;
if(me->key==0) { if(kb) curpos= kb->pos;
me->key= add_key( (ID *)me);
if (!offline) /* interactive */
rel = pupmenu("Insert Vertex Keys %t|"
"Relative Keys %x1|Absolute Keys %x2");
else /* we were called from a script */
rel = offline;
switch (rel) {
case 1:
me->key->type = KEY_RELATIVE;
break;
default:
default_key_ipo(me->key);
break;
}
}
key= me->key;
kb= MEM_callocN(sizeof(KeyBlock), "Keyblock"); kb= MEM_callocN(sizeof(KeyBlock), "Keyblock");
BLI_addtail(&key->block, kb); BLI_addtail(&key->block, kb);
kb->type= KEY_CARDINAL; kb->type= KEY_CARDINAL;
tot= BLI_countlist(&key->block);
curpos= bsystem_time(0, 0, (float)CFRA, 0.0); if(tot==1) strcpy(kb->name, "Basis");
if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &curpos)==0) { else sprintf(kb->name, "Key %d", tot-1);
curpos /= 100.0;
}
kb->pos= curpos;
key->totkey++; key->totkey++;
if(key->totkey==1) key->refkey= kb; if(key->totkey==1) key->refkey= kb;
mesh_to_key(me, kb); if(key->type == KEY_RELATIVE)
kb->pos= curpos+0.1;
sort_keys(me->key); else {
curpos= bsystem_time(0, 0, (float)CFRA, 0.0);
/* curent active: */ if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
kkb= key->block.first; curpos /= 100.0;
while(kkb) { }
kkb->flag &= ~SELECT; kb->pos= curpos;
if(kkb==kb) kkb->flag |= SELECT;
kkb= kkb->next; sort_keys(key);
} }
return kb;
}
void insert_meshkey(Mesh *me, short rel)
{
Key *key;
KeyBlock *kb;
if(me->key==NULL) {
me->key= add_key( (ID *)me);
if(rel)
me->key->type = KEY_RELATIVE;
else
default_key_ipo(me->key);
}
key= me->key;
kb= add_keyblock(key);
mesh_to_key(me, kb);
} }
/* ******************** */ /* ******************** */
@@ -449,43 +428,21 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
} }
void insert_lattkey(Lattice *lt) /* exported to python... hrms, should not, use object levels! (ton) */
void insert_lattkey(Lattice *lt, short rel)
{ {
Key *key; Key *key;
KeyBlock *kb, *kkb; KeyBlock *kb;
float curpos;
if(lt->key==0) { if(lt->key==NULL) {
lt->key= add_key( (ID *)lt); lt->key= add_key( (ID *)lt);
default_key_ipo(lt->key); default_key_ipo(lt->key);
} }
key= lt->key; key= lt->key;
kb= MEM_callocN(sizeof(KeyBlock), "Keyblock"); kb= add_keyblock(key);
BLI_addtail(&key->block, kb);
kb->type= KEY_CARDINAL;
curpos= bsystem_time(0, 0, (float)CFRA, 0.0);
if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &curpos)==0) {
curpos /= 100.0;
}
kb->pos= curpos;
key->totkey++;
if(key->totkey==1) key->refkey= kb;
latt_to_key(lt, kb); latt_to_key(lt, kb);
sort_keys(lt->key);
/* curent active: */
kkb= key->block.first;
while(kkb) {
kkb->flag &= ~SELECT;
if(kkb==kb) kkb->flag |= SELECT;
kkb= kkb->next;
}
} }
/* ******************************** */ /* ******************************** */
@@ -592,193 +549,115 @@ void key_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb)
} }
void insert_curvekey(Curve *cu, short rel)
void insert_curvekey(Curve *cu) /* must be fixed for non-UI use when bpy support is added.
see insert_meshkey. and fix callers to this of course. */
{ {
Key *key; Key *key;
KeyBlock *kb, *kkb; KeyBlock *kb;
float curpos;
short rel;
if(cu->key==0) { if(cu->key==NULL) {
cu->key= add_key( (ID *)cu); cu->key= add_key( (ID *)cu);
rel = pupmenu("Insert Vertex Keys %t|"
"Relative Keys %x1|Absolute Keys %x2");
switch (rel) { if (rel)
case 1: cu->key->type = KEY_RELATIVE; cu->key->type = KEY_RELATIVE;
break; else
default:
default_key_ipo(cu->key); default_key_ipo(cu->key);
break;
}
} }
key= cu->key; key= cu->key;
kb= MEM_callocN(sizeof(KeyBlock), "Keyblock"); kb= add_keyblock(key);
BLI_addtail(&key->block, kb);
kb->type= KEY_CARDINAL;
curpos= bsystem_time(0, 0, (float)CFRA, 0.0);
if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &curpos)==0) {
curpos /= 100.0;
}
kb->pos= curpos;
key->totkey++;
if(key->totkey==1) key->refkey= kb;
if(editNurb.first) curve_to_key(cu, kb, &editNurb); if(editNurb.first) curve_to_key(cu, kb, &editNurb);
else curve_to_key(cu, kb, &cu->nurb); else curve_to_key(cu, kb, &cu->nurb);
sort_keys(cu->key);
/* curent active: */
kkb= key->block.first;
while(kkb) {
kkb->flag &= ~SELECT;
if(kkb==kb) kkb->flag |= SELECT;
kkb= kkb->next;
}
} }
/* ******************** */ /* ******************** */
Key *give_current_key(Object *ob) void insert_shapekey(Object *ob)
{ {
Mesh *me; Key *key;
Curve *cu;
Lattice *lt;
if(ob->type==OB_MESH) { if(ob->type==OB_MESH) insert_meshkey(ob->data, 1);
me= ob->data; else if ELEM(ob->type, OB_CURVE, OB_SURF) insert_curvekey(ob->data, 1);
return me->key; else if(ob->type==OB_LATTICE) insert_lattkey(ob->data, 1);
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) { key= ob_get_key(ob);
cu= ob->data; ob->shapenr= BLI_countlist(&key->block);
return cu->key;
} allspace(REMAKEIPO, 0);
else if(ob->type==OB_LATTICE) { allqueue(REDRAWIPO, 0);
lt= ob->data; allqueue(REDRAWACTION, 0);
return lt->key; allqueue(REDRAWNLA, 0);
} allqueue(REDRAWBUTSOBJECT, 0);
return 0; allqueue(REDRAWBUTSEDIT, 0);
} }
void showkeypos(Key *key, KeyBlock *kb) void delete_key(Object *ob)
{
Object *ob;
Mesh *me;
Lattice *lt;
Curve *cu;
int tot;
/* from ipo */
ob= OBACT;
if(ob==NULL) return;
if(key == give_current_key(ob)) {
// key lock is for when a key is selected in the ipo window,
// it should be displayed in the 3d window then even though it
// is not actually for the current frame. this is not the best
// UI... - zr
key->flag |= KEY_LOCKED;
if(ob->type==OB_MESH) {
me= ob->data;
cp_key(0, me->totvert, me->totvert, (char *)me->mvert->co, me->key, kb, 0);
}
else if(ob->type==OB_LATTICE) {
lt= ob->data;
tot= lt->pntsu*lt->pntsv*lt->pntsw;
cp_key(0, tot, tot, (char *)lt->def->vec, lt->key, kb, 0);
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
cu= ob->data;
tot= count_curveverts(&cu->nurb);
cp_cu_key(cu, kb, 0, tot);
}
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
}
void deselectall_key(void)
{ {
KeyBlock *kb; KeyBlock *kb;
Key *key; Key *key;
IpoCurve *icu;
if(G.sipo->blocktype!=ID_KE) return;
key= (Key *)G.sipo->from;
if(key==0) return;
kb= key->block.first;
while(kb) {
kb->flag &= ~SELECT;
kb= kb->next;
}
}
void delete_key(void)
{
KeyBlock *kb, *kbn;
Key *key;
if(G.sipo->blocktype!=ID_KE) return; if(G.sipo->blocktype!=ID_KE) return;
if(okee("Erase selected keys")==0) return;
key= (Key *)G.sipo->from; key= (Key *)G.sipo->from;
if(key==0) return; if(key==NULL) return;
kb= key->block.first; kb= BLI_findlink(&key->block, ob->shapenr-1);
while(kb) {
kbn= kb->next; if(kb) {
if(kb->flag & SELECT) { BLI_remlink(&key->block, kb);
BLI_remlink(&key->block, kb); key->totkey--;
key->totkey--; if(key->refkey== kb) key->refkey= key->block.first;
if(key->refkey== kb) key->refkey= key->block.first;
if(kb->data) MEM_freeN(kb->data);
MEM_freeN(kb);
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--;
} }
kb= kbn;
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);
if(icu->bezt) MEM_freeN(icu->bezt);
MEM_freeN(icu);
break;
}
}
for(icu= key->ipo->curve.first; icu; icu= icu->next)
if(icu->adrcode>=ob->shapenr)
icu->adrcode--;
}
if(ob->shapenr>1) ob->shapenr--;
} }
if(key->totkey==0) { if(key->totkey==0) {
if(GS(key->from->name)==ID_ME) ((Mesh *)key->from)->key= 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= 0; 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= 0; else if(GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= NULL;
free_libblock_us(&(G.main->key), key); free_libblock_us(&(G.main->key), key);
scrarea_queue_headredraw(curarea); /* ipo remove too */ scrarea_queue_headredraw(curarea); /* ipo remove too */
} }
else {
key->flag &= ~KEY_LOCKED; DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
do_spec_key(key);
}
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
scrarea_queue_winredraw(curarea); allqueue(REDRAWBUTSEDIT, 0);
allspace(REMAKEIPO, 0);
allqueue(REDRAWIPO, 0);
} }
void move_keys(void) void move_keys(Object *ob)
{ {
Key *key; Key *key;
KeyBlock *kb; KeyBlock *kb;
TransVert *transmain, *tv; float div, dy, oldpos, vec[3], dvec[3];
float div, dy, vec[3], dvec[3]; int afbreek=0, firsttime= 1;
int a, tot=0, afbreek=0, firsttime= 1;
unsigned short event = 0; unsigned short event = 0;
short mval[2], val, xo, yo; short mval[2], val, xo, yo;
char str[32]; char str[32];
@@ -786,36 +665,21 @@ void move_keys(void)
if(G.sipo->blocktype!=ID_KE) return; if(G.sipo->blocktype!=ID_KE) return;
if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
if(G.sipo->editipo==0) return; if(G.sipo->editipo==NULL) return;
key= (Key *)G.sipo->from; key= (Key *)G.sipo->from;
if(key==0) return; if(key==NULL) return;
/* which keys are involved */ /* which kb is involved */
kb= key->block.first; kb= BLI_findlink(&key->block, ob->shapenr-1);
while(kb) { if(kb==NULL) return;
if(kb->flag & SELECT) tot++;
kb= kb->next;
}
if(tot==0) return; oldpos= kb->pos;
tv=transmain= MEM_callocN(tot*sizeof(TransVert), "transmain");
kb= key->block.first;
while(kb) {
if(kb->flag & SELECT) {
tv->loc= &kb->pos;
tv->oldloc[0]= kb->pos;
tv++;
}
kb= kb->next;
}
getmouseco_areawin(mval); getmouseco_areawin(mval);
xo= mval[0]; xo= mval[0];
yo= mval[1]; yo= mval[1];
dvec[0]=dvec[1]=dvec[2]= 0.0; dvec[0]=dvec[1]=dvec[2]= 0.0;
while(afbreek==0) { while(afbreek==0) {
getmouseco_areawin(mval); getmouseco_areawin(mval);
@@ -832,10 +696,7 @@ void move_keys(void)
apply_keyb_grid(vec, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); apply_keyb_grid(vec, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
apply_keyb_grid(vec+1, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); apply_keyb_grid(vec+1, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
tv= transmain; kb->pos= oldpos+vec[1];
for(a=0; a<tot; a++, tv++) {
tv->loc[0]= tv->oldloc[0]+vec[1];
}
sprintf(str, "Y: %.3f ", vec[1]); sprintf(str, "Y: %.3f ", vec[1]);
headerprint(str); headerprint(str);
@@ -864,20 +725,18 @@ void move_keys(void)
} }
if(event==ESCKEY) { if(event==ESCKEY) {
tv= transmain; kb->pos= oldpos;
for(a=0; a<tot; a++, tv++) {
tv->loc[0]= tv->oldloc[0];
}
} }
sort_keys(key); sort_keys(key);
key->flag &= ~KEY_LOCKED; DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
do_spec_key(key);
/* for boundbox */ /* for boundbox */
editipo_changed(G.sipo, 0); editipo_changed(G.sipo, 0);
MEM_freeN(transmain); allspace(REMAKEIPO, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
scrarea_queue_redraw(curarea); scrarea_queue_redraw(curarea);
} }

View File

@@ -44,24 +44,24 @@
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_arithb.h" #include "BLI_arithb.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_lattice_types.h"
#include "DNA_curve_types.h" #include "DNA_curve_types.h"
#include "DNA_key_types.h" #include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h" #include "DNA_view3d_types.h"
#include "BKE_key.h"
#include "BKE_depsgraph.h" #include "BKE_depsgraph.h"
#include "BKE_lattice.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
#include "BIF_space.h"
#include "BIF_screen.h"
#include "BIF_editlattice.h" #include "BIF_editlattice.h"
#include "BIF_editmode_undo.h" #include "BIF_editmode_undo.h"
#include "BIF_editkey.h" #include "BIF_editkey.h"
#include "BIF_space.h"
#include "BIF_screen.h"
#include "BIF_toolbox.h" #include "BIF_toolbox.h"
#include "BSE_edit.h" #include "BSE_edit.h"
@@ -114,7 +114,7 @@ void make_editLatt(void)
lt= G.obedit->data; lt= G.obedit->data;
actkey = key_get_active(lt->key); actkey = ob_get_keyblock(G.obedit);
if(actkey) { if(actkey) {
strcpy(G.editModeTitleExtra, "(Key) "); strcpy(G.editModeTitleExtra, "(Key) ");
key_to_latt(actkey, lt); key_to_latt(actkey, lt);
@@ -138,7 +138,7 @@ void load_editLatt(void)
lt= G.obedit->data; lt= G.obedit->data;
actkey = key_get_active(lt->key); actkey = ob_get_keyblock(G.obedit);
if(actkey) { if(actkey) {
/* active key: vertices */ /* active key: vertices */
tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;

View File

@@ -728,7 +728,7 @@ void make_editMesh()
/* initialize fastmalloc for editmesh */ /* initialize fastmalloc for editmesh */
init_editmesh_fastmalloc(G.editMesh, me->totvert, me->totedge, me->totface); init_editmesh_fastmalloc(G.editMesh, me->totvert, me->totedge, me->totface);
actkey = key_get_active(me->key); actkey = ob_get_keyblock(G.obedit);
if(actkey) { if(actkey) {
strcpy(G.editModeTitleExtra, "(Key) "); strcpy(G.editModeTitleExtra, "(Key) ");
key_to_mesh(actkey, me); key_to_mesh(actkey, me);
@@ -1118,7 +1118,7 @@ void load_editMesh(void)
/* are there keys? */ /* are there keys? */
if(me->key) { if(me->key) {
KeyBlock *currkey, *actkey = key_get_active(me->key); KeyBlock *currkey, *actkey = ob_get_keyblock(G.obedit);
/* Lets reorder the key data so that things line up roughly /* Lets reorder the key data so that things line up roughly
* with the way things were before editmode */ * with the way things were before editmode */

View File

@@ -172,28 +172,24 @@ static void do_ipo_editmenu_keymenu(void *arg, int event)
{ {
Key *key; Key *key;
KeyBlock *kb; KeyBlock *kb;
Object *ob= OBACT;
if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0) { if(G.sipo->blocktype==ID_KE && totipo_edit==0 && totipo_sel==0) {
key= (Key *)G.sipo->from; key= (Key *)G.sipo->from;
if(key==0) return; if(key==NULL) return;
kb= key->block.first;
while(kb) { kb= BLI_findlink(&key->block, ob->shapenr-1);
if(kb->flag & SELECT) { kb->type= 0;
kb->type= 0; switch(event){
switch(event){ case 0:
case 0: kb->type= KEY_LINEAR;
kb->type= KEY_LINEAR; break;
break; case 1:
case 1: kb->type= KEY_CARDINAL;
kb->type= KEY_CARDINAL; break;
break; case 2:
case 2: kb->type= KEY_BSPLINE;
kb->type= KEY_BSPLINE; break;
break;
}
}
kb= kb->next;
} }
} }
} }
@@ -623,7 +619,7 @@ static char *ipo_modeselect_pup(void)
if(OBACT){ if(OBACT){
if ELEM4(OBACT->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE) { if ELEM4(OBACT->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE) {
sprintf(tmpstr,formatstring,"Vertex",ID_KE, ICON_EDIT); sprintf(tmpstr,formatstring,"Shape",ID_KE, ICON_EDIT);
strcat(string,tmpstr); strcat(string,tmpstr);
} }
if (OBACT->action){ if (OBACT->action){

View File

@@ -2122,9 +2122,9 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st
// icons a bit higher // icons a bit higher
if(tselem->flag & TSE_CLOSED) if(tselem->flag & TSE_CLOSED)
BIF_draw_icon(icon_x, *starty+2, ICON_TRIA_CLOSED); BIF_draw_icon(icon_x, *starty+2, ICON_TRIA_RIGHT);
else else
BIF_draw_icon(icon_x, *starty+2, ICON_TRIA_OPEN); BIF_draw_icon(icon_x, *starty+2, ICON_TRIA_DOWN);
} }
offsx+= OL_X; offsx+= OL_X;

View File

@@ -2106,10 +2106,7 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break; break;
case XKEY: case XKEY:
case DELKEY: case DELKEY:
if((G.qual==LR_SHIFTKEY)) del_ipo();
delete_key();
else if((G.qual==0))
del_ipo();
break; break;
} }
} }

View File

@@ -1542,6 +1542,12 @@ static void set_trans_object_base_flags(TransInfo *t)
/* makes sure base flags and object flags are identical */ /* makes sure base flags and object flags are identical */
copy_baseflags(); copy_baseflags();
/* handle pending update events, otherwise they got copied below */
for (base= FIRSTBASE; base; base= base->next) {
if(base->object->recalc)
object_handle_update(base->object);
}
for (base= FIRSTBASE; base; base= base->next) { for (base= FIRSTBASE; base; base= base->next) {
base->flag &= ~BA_WAS_SEL; base->flag &= ~BA_WAS_SEL;