diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-09-14 16:41:42 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-09-14 16:41:42 +0400 |
commit | 4245aaed86dad24395d8b863832be23fcb85ae4e (patch) | |
tree | 6001aea0a084a5806270de768124fd931e670152 /source | |
parent | 2bf26b93e12de1382850712551ea7203c5b80692 (diff) |
== Global 'Delete Key' Tool ==
The 'opposite' of the "Insert Key" tool.
- Use the hotkey Ctrl-Alt-IKEY to activate.
- Only available in 3d-view and buttons window
I've added an extra var to verify_ipo and verify_ipocurve to save having to make another duplicate of that code. Hopefully the gameengine compiles ok with this.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/bad_level_call_stubs/stubs.c | 4 | ||||
-rw-r--r-- | source/blender/include/BSE_editipo.h | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Constraint.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 8 | ||||
-rw-r--r-- | source/blender/src/drawipo.c | 2 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 2 | ||||
-rw-r--r-- | source/blender/src/editipo.c | 183 | ||||
-rw-r--r-- | source/blender/src/editkey.c | 4 | ||||
-rw-r--r-- | source/blender/src/keyframing.c | 54 | ||||
-rw-r--r-- | source/blender/src/toets.c | 4 | ||||
-rw-r--r-- | source/gameengine/Converter/KX_BlenderSceneConverter.cpp | 26 |
12 files changed, 179 insertions, 116 deletions
diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c index d7ef5cb54ff..f4beca262d7 100644 --- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c +++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c @@ -60,7 +60,7 @@ struct EditFace; char *getIpoCurveName( struct IpoCurve * icu ); void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast); -struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e); +struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e, short f); void elbeemDebugOut(char *msg); void fluidsimSettingsFree(struct FluidsimSettings* sb); void fluidsimSettingsCopy(struct FluidsimSettings* sb); @@ -88,7 +88,7 @@ void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast) } -struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e) +struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e, short f) { return 0; } diff --git a/source/blender/include/BSE_editipo.h b/source/blender/include/BSE_editipo.h index b7b19a373aa..807e338f514 100644 --- a/source/blender/include/BSE_editipo.h +++ b/source/blender/include/BSE_editipo.h @@ -86,8 +86,8 @@ void do_ipo_selectbuttons(void); /* gets ipo curve, creates if needed */ -struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int); -struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *); +struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int, short); +struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *, short); int texchannel_to_adrcode(int channel); diff --git a/source/blender/python/api2_2x/Constraint.c b/source/blender/python/api2_2x/Constraint.c index 156d32d55c0..b0b9aa04a08 100644 --- a/source/blender/python/api2_2x/Constraint.c +++ b/source/blender/python/api2_2x/Constraint.c @@ -442,7 +442,7 @@ static PyObject *Constraint_insertKey( BPy_Constraint * self, PyObject * value ) return EXPP_ReturnPyObjError( PyExc_RuntimeError, "constraint doesn't belong to anything" ); } - icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE); + icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE, 1); if (!icu) return EXPP_ReturnPyObjError( PyExc_RuntimeError, diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index a9cbd1c7766..45d6bfa3c01 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -2735,7 +2735,7 @@ static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self, "expects bonename, constraintname, influenceval" ); icu = verify_ipocurve((ID *)self->object, ID_CO, boneName, constName, NULL, - CO_ENFORCE); + CO_ENFORCE, 1); if (!icu) return EXPP_ReturnPyObjError( PyExc_RuntimeError, diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 71e5ff6c10e..c1af6c2d00c 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -242,9 +242,9 @@ static void enable_constraint_ipo_func (void *ob_v, void *con_v) /* adds ipo & channels & curve if needed */ if(con->flag & CONSTRAINT_OWN_IPO) - verify_ipo((ID *)ob, ID_CO, NULL, con->name, actname); + verify_ipo((ID *)ob, ID_CO, NULL, con->name, actname, 1); else - verify_ipo((ID *)ob, ID_CO, actname, con->name, NULL); + verify_ipo((ID *)ob, ID_CO, actname, con->name, NULL, 1); /* make sure ipowin shows it */ ob->ipowin= ID_CO; @@ -269,9 +269,9 @@ static void add_influence_key_to_constraint_func (void *ob_v, void *con_v) /* adds ipo & channels & curve if needed */ if(con->flag & CONSTRAINT_OWN_IPO) - icu= verify_ipocurve((ID *)ob, ID_CO, NULL, con->name, actname, CO_ENFORCE); + icu= verify_ipocurve((ID *)ob, ID_CO, NULL, con->name, actname, CO_ENFORCE, 1); else - icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE); + icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE, 1); if (!icu) { error("Cannot get a curve from this IPO, may be dealing with linked data"); diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index 87e36c4ad24..ec6a0f0d75b 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -1952,7 +1952,7 @@ void do_ipobuts(unsigned short event) ei= get_active_editipo(); if(ei) { if(ei->icu==NULL) { - ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode); + ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode, 1); if (!ei->icu) { error("Could not add a driver to this curve, may be linked data!"); break; diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 95a69171bf8..fe83976ee57 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -2154,7 +2154,7 @@ void paste_actdata () /* loop over curves, pasting keyframes */ for (ico= ipo_src->curve.first; ico; ico= ico->next) { - icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, "", ico->adrcode); + icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, "", ico->adrcode, 1); if (icu) { /* just start pasting, with the the first keyframe on the current frame, and so on */ diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index e6c7e155a0f..09862636085 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -1777,113 +1777,129 @@ void do_ipo_selectbuttons(void) - if bonename, the constname is the ipo to the constraint */ -/* note; check header_ipo.c, spaceipo_assign_ipo() too */ -Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char *bonename) +/* note: check header_ipo.c, spaceipo_assign_ipo() too */ +Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char *bonename, short add) { - - if(from==NULL || from->lib) return NULL; + /* lib-linked data is not appropriate here */ + if ((from==NULL) || (from->lib)) + return NULL; /* first check action ipos */ - if(actname && actname[0]) { + if (actname && actname[0]) { Object *ob= (Object *)from; bActionChannel *achan; - if(GS(from->name)!=ID_OB) { + if (GS(from->name)!=ID_OB) { printf("called ipo system for action with wrong base pointer\n"); return NULL; } - if(ob->action==NULL) + if ((ob->action==NULL) && (add)) ob->action= add_empty_action("Action"); - achan= verify_action_channel(ob->action, actname); + if (add) + achan= verify_action_channel(ob->action, actname); + else + achan= get_action_channel(ob->action, actname); - if(achan) { + if (achan) { /* automatically assign achan to act-group based on pchan's grouping */ - if (blocktype == ID_PO) + if ((blocktype == ID_PO) && (add)) verify_pchan2achan_grouping(ob->action, ob->pose, actname); /* constraint exception */ - if(blocktype==ID_CO) { - bConstraintChannel *conchan= verify_constraint_channel(&achan->constraintChannels, constname); - if(conchan->ipo==NULL) { - conchan->ipo= add_ipo("CoIpo", ID_CO); + if (blocktype==ID_CO) { + bConstraintChannel *conchan; + + if (add) + conchan= verify_constraint_channel(&achan->constraintChannels, constname); + else + conchan= get_constraint_channel(&achan->constraintChannels, constname); + + if (conchan) { + if ((conchan->ipo==NULL) && (add)) + conchan->ipo= add_ipo("CoIpo", ID_CO); + return conchan->ipo; } - return conchan->ipo; } else { - if(achan->ipo==NULL) { + if ((achan->ipo==NULL) && (add)) achan->ipo= add_ipo("ActIpo", blocktype); - } - return achan->ipo; } } } else { - - switch(GS(from->name)) { + switch (GS(from->name)) { case ID_OB: { Object *ob= (Object *)from; /* constraint exception */ - if(blocktype==ID_CO) { + if (blocktype==ID_CO) { /* check the local constraint ipo */ - if(bonename && bonename[0] && ob->pose) { + if (bonename && bonename[0] && ob->pose) { bPoseChannel *pchan= get_pose_channel(ob->pose, bonename); bConstraint *con; - for(con= pchan->constraints.first; con; con= con->next) - if(strcmp(con->name, constname)==0) + + for (con= pchan->constraints.first; con; con= con->next) { + if (strcmp(con->name, constname)==0) break; - if(con) { - if(con->ipo==NULL) { + } + + if (con) { + if ((con->ipo==NULL) && (add)) con->ipo= add_ipo("CoIpo", ID_CO); - } return con->ipo; } } else { /* the actionchannel */ - bConstraintChannel *conchan= verify_constraint_channel(&ob->constraintChannels, constname); - if(conchan->ipo==NULL) { - conchan->ipo= add_ipo("CoIpo", ID_CO); + bConstraintChannel *conchan; + + if (add) + conchan= verify_constraint_channel(&ob->constraintChannels, constname); + else + conchan= get_constraint_channel(&ob->constraintChannels, constname); + + if (conchan) { + if ((conchan->ipo==NULL) && (add)) + conchan->ipo= add_ipo("CoIpo", ID_CO); + return conchan->ipo; } - return conchan->ipo; } } - else if(blocktype==ID_OB) { - if(ob->ipo==NULL) { + else if (blocktype==ID_OB) { + if ((ob->ipo==NULL) && (add)) ob->ipo= add_ipo("ObIpo", ID_OB); - } return ob->ipo; } - else if(blocktype==ID_KE) { + else if (blocktype==ID_KE) { Key *key= ob_get_key((Object *)from); - if(key) { - if(key->ipo==NULL) { + if (key) { + if ((key->ipo==NULL) && (add)) key->ipo= add_ipo("KeyIpo", ID_KE); - } return key->ipo; } return NULL; } - else if(blocktype== ID_FLUIDSIM) { + else if (blocktype== ID_FLUIDSIM) { Object *ob= (Object *)from; - if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) { + + if (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) { FluidsimSettings *fss= ob->fluidsimSettings; - if(fss->ipo==NULL) { + + if ((fss->ipo==NULL) && (add)) fss->ipo= add_ipo("FluidsimIpo", ID_FLUIDSIM); - //fprintf(stderr,"FSIPO NEW!\n"); - } return fss->ipo; } } - else if(blocktype== ID_PA){ + else if(blocktype== ID_PA) { Object *ob= (Object *)from; ParticleSystem *psys= psys_get_current(ob); - if(psys){ - if(psys->part->ipo==0) + + if (psys) { + if ((psys->part->ipo==NULL) && (add)) psys->part->ipo= add_ipo("ParticleIpo", ID_PA); return psys->part->ipo; } @@ -1894,30 +1910,27 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char case ID_MA: { Material *ma= (Material *)from; - - if(ma->ipo==NULL) { + + if ((ma->ipo==NULL) && (add)) ma->ipo= add_ipo("MatIpo", ID_MA); - } return ma->ipo; } break; case ID_TE: { Tex *tex= (Tex *)from; - - if(tex->ipo==NULL) { + + if ((tex->ipo==NULL) && (add)) tex->ipo= add_ipo("TexIpo", ID_TE); - } return tex->ipo; } break; case ID_SEQ: { Sequence *seq= (Sequence *)from; /* note, sequence is mimicing Id */ - - if(seq->ipo==NULL) { + + if ((seq->ipo==NULL) && (add)) seq->ipo= add_ipo("SeqIpo", ID_SEQ); - } update_seq_ipo_rect(seq); return seq->ipo; } @@ -1926,19 +1939,17 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char { Curve *cu= (Curve *)from; - if(cu->ipo==NULL) { + if ((cu->ipo==NULL) && (add)) cu->ipo= add_ipo("CuIpo", ID_CU); - } return cu->ipo; } break; case ID_WO: { World *wo= (World *)from; - - if(wo->ipo==NULL) { + + if ((wo->ipo==NULL) && (add)) wo->ipo= add_ipo("WoIpo", ID_WO); - } return wo->ipo; } break; @@ -1946,29 +1957,26 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char { Lamp *la= (Lamp *)from; - if(la->ipo==NULL) { + if ((la->ipo==NULL) && (add)) la->ipo= add_ipo("LaIpo", ID_LA); - } return la->ipo; } break; case ID_CA: { Camera *ca= (Camera *)from; - - if(ca->ipo==NULL) { + + if ((ca->ipo==NULL) && (add)) ca->ipo= add_ipo("CaIpo", ID_CA); - } return ca->ipo; } break; case ID_SO: { bSound *snd= (bSound *)from; - - if(snd->ipo==NULL) { + + if ((snd->ipo==NULL) && (add)) snd->ipo= add_ipo("SndIpo", ID_SO); - } return snd->ipo; } } @@ -1980,32 +1988,36 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char /* returns and creates * Make sure functions check for NULL or they will crash! * */ -IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constname, char *bonename, int adrcode) +IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constname, char *bonename, int adrcode, short add) { Ipo *ipo; IpoCurve *icu= NULL; /* return 0 if lib */ - /* creates ipo too */ - ipo= verify_ipo(from, blocktype, actname, constname, bonename); + /* creates ipo too (if add) */ + ipo= verify_ipo(from, blocktype, actname, constname, bonename, add); - if(ipo && ipo->id.lib==NULL && from->lib==NULL) { - - for(icu= ipo->curve.first; icu; icu= icu->next) { - if(icu->adrcode==adrcode) break; + if (ipo && ipo->id.lib==NULL && from->lib==NULL) { + /* try to find matching curve */ + for (icu= ipo->curve.first; icu; icu= icu->next) { + if (icu->adrcode==adrcode) + break; } - if(icu==NULL) { + + /* make a new one if none found (and can add) */ + if ((icu==NULL) && (add)) { icu= MEM_callocN(sizeof(IpoCurve), "ipocurve"); - icu->flag |= IPO_VISIBLE|IPO_AUTO_HORIZ; - if(ipo->curve.first==NULL) icu->flag |= IPO_ACTIVE; /* first one added active */ + icu->flag |= (IPO_VISIBLE|IPO_AUTO_HORIZ); + if (ipo->curve.first==NULL) + icu->flag |= IPO_ACTIVE; /* first one added active */ icu->blocktype= blocktype; icu->adrcode= adrcode; set_icu_vars(icu); - BLI_addtail( &(ipo->curve), icu); + BLI_addtail(&ipo->curve, icu); switch (GS(from->name)) { case ID_SEQ: { @@ -2017,7 +2029,8 @@ IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constn } } } - + + /* return ipo-curve */ return icu; } @@ -2055,7 +2068,7 @@ void add_vert_ipo(void) if(ei->icu==NULL) { if(G.sipo->from) { - ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode); + ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode, 1); if (ei->icu) ei->flag |= ei->icu->flag & IPO_AUTO_HORIZ; /* new curve could have been added, weak... */ else @@ -3185,7 +3198,7 @@ void paste_editipo(void) int i; /* make sure an ipo-curve exists (it may not, as this is an editipo) */ - ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode); + ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode, 1); if (ei->icu == NULL) return; /* Copy selected beztriples from source icu onto this edit-icu, @@ -3226,7 +3239,7 @@ void paste_editipo(void) else { /* make sure an ipo-curve exists (it may not, as this is an editipo) */ - ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode); + ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei->adrcode, 1); if (ei->icu==NULL) return; /* clear exisiting dynamic memory (keyframes, driver) */ @@ -4341,7 +4354,7 @@ void ipo_record(void) /* make curves ready, start values */ if(ei1->icu==NULL) - ei1->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei1->adrcode); + ei1->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei1->adrcode, 1); if(ei1->icu==NULL) return; poin= get_ipo_poin(G.sipo->from, ei1->icu, &type); @@ -4351,7 +4364,7 @@ void ipo_record(void) if(ei2) { if(ei2->icu==NULL) - ei2->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei2->adrcode); + ei2->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei2->adrcode, 1); if(ei2->icu==NULL) return; poin= get_ipo_poin(G.sipo->from, ei2->icu, &type); diff --git a/source/blender/src/editkey.c b/source/blender/src/editkey.c index cf12e171a9c..dbabf9d19fb 100644 --- a/source/blender/src/editkey.c +++ b/source/blender/src/editkey.c @@ -171,9 +171,9 @@ static void rvk_slider_func(void *voidob, void *voidkeynum) /* ipo on action or ob? */ if(ob->ipoflag & OB_ACTION_KEY) - icu = verify_ipocurve(&ob->id, ID_KE, "Shape", NULL, NULL, keynum); + icu = verify_ipocurve(&ob->id, ID_KE, "Shape", NULL, NULL, keynum, 1); else - icu = verify_ipocurve(&ob->id, ID_KE, NULL, NULL, NULL, keynum); + icu = verify_ipocurve(&ob->id, ID_KE, NULL, NULL, NULL, keynum, 1); if (icu) { /* if the ipocurve exists, try to get a bezier diff --git a/source/blender/src/keyframing.c b/source/blender/src/keyframing.c index fd9b19cc3b0..80d4ebffec9 100644 --- a/source/blender/src/keyframing.c +++ b/source/blender/src/keyframing.c @@ -723,7 +723,7 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc IpoCurve *icu; /* get ipo-curve */ - icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode); + icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode, 1); /* only continue if we have an ipo-curve to add keyframe to */ if (icu) { @@ -815,12 +815,58 @@ short insertkey (ID *id, int blocktype, char *actname, char *constname, int adrc */ short deletekey (ID *id, int blocktype, char *actname, char *constname, int adrcode, short flag) { + Ipo *ipo; IpoCurve *icu; - // locate ipo-curve - icu= NULL; // fixme.. + /* get ipo-curve + * Note: here is one of the places where we don't want new ipo + ipo-curve added! + * so 'add' var must be 0 + */ + ipo= verify_ipo(id, blocktype, actname, constname, NULL, 0); + icu= verify_ipocurve(id, blocktype, actname, constname, NULL, adrcode, 0); - // TODO: implement me! + /* only continue if we have an ipo-curve to remove keyframes from */ + if (icu) { + BezTriple bezt; + float cfra = frame_to_float(CFRA); + short found = -1; + int i; + + /* apply special time tweaking */ + if (GS(id->name) == ID_OB) { + Object *ob= (Object *)id; + + /* apply NLA-scaling (if applicable) */ + if (actname && actname[0]) + cfra= get_action_frame(ob, cfra); + + /* ancient time-offset cruft */ + if ( (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)) ) { + /* actually frametofloat calc again! */ + cfra-= give_timeoffset(ob)*G.scene->r.framelen; + } + } + + /* only need to set bezt->vec[1][0], as that's all binarysearch uses */ + memset(&bezt, 0, sizeof(BezTriple)); + bezt.vec[1][0]= cfra; + + /* try to find index of beztriple to get rid of */ + i = binarysearch_bezt_index(icu->bezt, &bezt, icu->totvert, &found); + if (found) { + /* delete the key at the index (will sanity check + do recalc afterwards ) */ + delete_icu_key(icu, i, 1); + + /* Only delete curve too 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); + } + + /* return success */ + return 1; + } + } /* return failure */ return 0; diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index 8bd10b7186d..41ee557c9c2 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -793,6 +793,10 @@ int blenderqread(unsigned short event, short val) ob= OBACT; if(G.f & G_SCULPTMODE) return 1; + else if(G.qual==(LR_CTRLKEY|LR_ALTKEY)) { + common_deletekey(); + return 0; + } else if(G.qual==0) { common_insertkey(); return 0; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index b05893da4e1..7eec93dc402 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -660,7 +660,7 @@ extern "C" { Ipo *add_ipo( char *name, int idcode ); char *getIpoCurveName( IpoCurve * icu ); - struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int); + struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int, short); void testhandles_ipocurve(struct IpoCurve *icu); void insert_vert_icu(struct IpoCurve *, float, float, short); void Mat3ToEul(float tmat[][3], float *eul); @@ -873,27 +873,27 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) IpoCurve *icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1); @@ -1029,27 +1029,27 @@ void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo() IpoCurve *icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1); icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"); if (!icu1) - icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z); + icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1); |