Page MenuHome

delete_keyframe.patch

File Metadata

Author
Davide Vercelli (unclezeiv)
Created
Nov 13 2013, 1:01 PM

delete_keyframe.patch

Index: source/blender/include/BSE_editipo.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BSE_editipo.h,v
retrieving revision 1.23
diff -u -r1.23 BSE_editipo.h
--- source/blender/include/BSE_editipo.h 27 Feb 2006 11:45:42 -0000 1.23
+++ source/blender/include/BSE_editipo.h 14 Apr 2006 16:59:29 -0000
@@ -113,6 +113,7 @@
void insertkey(ID *id, int blocktype, char *actname, char *constname, int adrcode);
void insertkey_editipo(void);
void common_insertkey(void);
+void common_deletekey(void);
void free_ipokey(struct ListBase *lb);
void add_to_ipokey(struct ListBase *lb, struct BezTriple *bezt, int nr, int len);
void make_ipokey(void);
Index: source/blender/src/editipo.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editipo.c,v
retrieving revision 1.93
diff -u -r1.93 editipo.c
--- source/blender/src/editipo.c 11 Apr 2006 10:09:33 -0000 1.93
+++ source/blender/src/editipo.c 14 Apr 2006 16:59:37 -0000
@@ -1818,6 +1818,118 @@
return NULL;
}
+/* same as verify_ipo but doesn't create if ipo is absent */
+static Ipo *get_ipo(ID *from, short blocktype, char *actname, char *constname)
+{
+ Object *ob= (Object *)from;
+
+ if(from==NULL || from->lib) return NULL;
+
+ /* first check action ipos */
+ if(actname && actname[0]) {
+ bActionChannel *achan;
+
+ if(GS(from->name)!=ID_OB) {
+ printf("called ipo system for action with wrong base pointer\n");
+ return NULL;
+ }
+
+ if(ob->action==NULL)
+ return NULL;
+
+ achan= get_action_channel(ob->action, actname);
+
+ if(achan==NULL)
+ return NULL;
+
+ /* constraint exception */
+ if(blocktype==ID_CO) {
+ bConstraintChannel *conchan= get_constraint_channel(&achan->constraintChannels, constname);
+ return conchan ? conchan->ipo : NULL;
+ }
+ else
+ return achan->ipo;
+ }
+
+ switch(GS(from->name)) {
+ case ID_OB:
+ switch(blocktype) {
+ case ID_CO:
+ { /* constraint exception */
+ bConstraintChannel *conchan= get_constraint_channel(&ob->constraintChannels, constname);
+ return conchan ? conchan->ipo : NULL;
+ }
+ case ID_OB:
+ {
+ return ob->ipo;
+ }
+ case ID_KE:
+ {
+ Key *key= ob_get_key((Object *)from);
+ return key ? key->ipo : NULL;
+ }
+ case ID_FLUIDSIM:
+ {
+ if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
+ FluidsimSettings *fss= ob->fluidsimSettings;
+ return fss->ipo;
+ }
+ }
+ break;
+ }
+ break;
+ case ID_MA:
+ {
+ Material *ma= (Material *)from;
+ return ma->ipo;
+ }
+ case ID_TE:
+ {
+ Tex *tex= (Tex *)from;
+ return tex->ipo;
+ }
+ case ID_SEQ:
+ {
+ Sequence *seq= (Sequence *)from; /* note, sequence is mimicing Id */
+
+ if((seq->type & SEQ_EFFECT)||
+ (seq->type == SEQ_RAM_SOUND)||
+ (seq->type == SEQ_HD_SOUND)) {
+ update_seq_ipo_rect(seq);
+ return seq->ipo;
+ }
+ }
+ break;
+ case ID_CU:
+ {
+ Curve *cu= (Curve *)from;
+ return cu->ipo;
+ }
+ case ID_WO:
+ {
+ World *wo= (World *)from;
+ return wo->ipo;
+ }
+ case ID_LA:
+ {
+ Lamp *la= (Lamp *)from;
+ return la->ipo;
+ }
+ case ID_CA:
+ {
+ Camera *ca= (Camera *)from;
+ return ca->ipo;
+ }
+ case ID_SO:
+ {
+ bSound *snd= (bSound *)from;
+ return snd->ipo;
+ }
+ }
+
+ return NULL;
+}
+
/* returns and creates */
IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constname, int adrcode)
{
@@ -1920,6 +2032,55 @@
}
}
+static void delete_vert_ipo(IpoCurve *icu, float x)
+{
+ BezTriple *bezt;
+ int a = 0;
+
+ if (icu==NULL)
+ return;
+
+ bezt= icu->bezt;
+
+ if(bezt==NULL)
+ return;
+
+ /* all vertices deselect TODO: needed? */
+ for(a=0; a<icu->totvert; a++, bezt++)
+ bezt->f1= bezt->f2= bezt->f3= 0;
+
+ bezt= icu->bezt;
+ for (a=0; a<icu->totvert; a++){
+ if (bezt->vec[1][0] > x)
+ break;
+
+ if (bezt->vec[1][0] > x-IPOTHRESH && bezt->vec[1][0] < x+IPOTHRESH) {
+ /* Delete the item */
+ if (icu->totvert > 1)
+ memcpy (bezt, bezt + 1, sizeof (BezTriple)*(icu->totvert-a-1));
+ icu->totvert--;
+ a--;
+ }
+ else
+ bezt++;
+ }
+
+#if 0 /* TODO: needed? */
+ calchandles_ipocurve(icu);
+
+ /* set handletype */
+ if(icu->totvert>2) {
+ h1= h2= HD_AUTO;
+ if(a>0) h1= (bezt-1)->h2;
+ if(a<icu->totvert-1) h2= (bezt+1)->h1;
+ bezt->h1= h1;
+ bezt->h2= h2;
+
+ calchandles_ipocurve(icu);
+ }
+#endif
+}
+
void add_vert_ipo(void)
{
EditIpo *ei;
@@ -2024,6 +2185,51 @@
}
}
+void deletekey(ID *id, int blocktype, char *actname, char *constname, int adrcode)
+{
+ Ipo *ipo;
+ IpoCurve *icu = NULL;
+ Object *ob;
+ float cfra;
+
+ ipo= get_ipo(id, blocktype, actname, constname);
+
+ /* no ipo, no curve, no key to delete */
+ if(!ipo || ipo->id.lib != NULL)
+ return;
+
+ /* let's find the correct curve */
+ for(icu= ipo->curve.first; icu; icu= icu->next)
+ if(icu->adrcode==adrcode)
+ break;
+
+ /* no curve no party */
+ if (!icu)
+ return;
+
+ cfra= frame_to_float(CFRA);
+
+ /* if action is mapped in NLA, it returns a correction */
+ if(actname && actname[0] && GS(id->name)==ID_OB)
+ cfra= get_action_frame((Object *)id, cfra);
+
+ if( GS(id->name)==ID_OB ) {
+ ob= (Object *)id;
+ if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
+ /* actually frametofloat calc again! */
+ cfra-= ob->sf*G.scene->r.framelen;
+ }
+ }
+
+ delete_vert_ipo(icu, cfra);
+
+ if (!icu->totvert){
+ /* Delete the curve */
+ BLI_remlink( &(ipo->curve), icu);
+ free_ipo_curve(icu);
+ }
+}
+
/* For inserting keys based on the object matrix - not on the current IPO value
Generically - it inserts the passed float value into the appropriate IPO */
void insertmatrixkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, float matrixvalue)
@@ -2184,6 +2390,73 @@
allspace(REMAKEIPO, 0);
}
+
+void deletekey_editipo(void)
+{
+ EditIpo *ei;
+ IpoKey *ik;
+ ID *id;
+ float cfra;
+ int nr, ok;
+ short event;
+
+ ei= get_active_editipo();
+ if(ei && ei->icu && ei->icu->driver)
+ event= 0; /* should restore previous curve, but you have ctrl-z for that */
+ else if(G.sipo->showkey)
+ event= pupmenu("Delete Key Vertices %t|Current Frame %x1|Selected Keys %x2");
+ else
+ event= pupmenu("Delete Key Vertices %t|Current Frame %x1");
+
+ if(event<1) return;
+
+ ei= G.sipo->editipo;
+ for(nr=0; nr<G.sipo->totipo; nr++, ei++) {
+ if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
+
+ ok= 0;
+ if(G.sipo->showkey) ok= 1;
+ else if(ei->flag & IPO_SELECT) ok= 1;
+
+ if(!ok)
+ continue;
+
+ /* correction for ob timeoffs */
+ cfra= frame_to_float(CFRA);
+ id= G.sipo->from;
+ if(id && GS(id->name)==ID_OB ) {
+ Object *ob= (Object *)id;
+ if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
+ cfra-= ob->sf*G.scene->r.framelen;
+ }
+ }
+ else if(id && GS(id->name)==ID_SEQ) {
+ Sequence *last_seq = get_last_seq(); /* editsequence.c */
+
+ if(last_seq) {
+ cfra= (float)(100.0*(cfra-last_seq->startdisp)/((float)(last_seq->enddisp-last_seq->startdisp)));
+ }
+ }
+
+ /* count amount */
+ if(event==1)
+ delete_vert_ipo(ei->icu, cfra);
+ else {
+ ik= G.sipo->ipokey.first;
+ while(ik) {
+ if(ik->flag & 1)
+ delete_vert_ipo(ei->icu, cfra);
+ ik= ik->next;
+ }
+ }
+ }
+ }
+ BIF_undo_push("Delete Key Ipo");
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue(REDRAWIPO, 0);
+ allspace(REMAKEIPO, 0);
+}
void common_insertkey(void)
{
@@ -2693,6 +2966,501 @@
}
+void common_deletekey(void)
+{
+ Base *base;
+ Object *ob;
+ Material *ma;
+ ID *id;
+ IpoCurve *icu;
+ World *wo;
+ Lamp *la;
+ Tex *te;
+ int tlay, map, event;
+ char menustr[256];
+
+ if(curarea->spacetype==SPACE_IPO) {
+ deletekey_editipo();
+ }
+ else if(curarea->spacetype==SPACE_BUTS) {
+ if(G.buts->mainb==CONTEXT_SHADING) {
+ int tab= G.buts->tab[CONTEXT_SHADING];
+
+ if(tab==TAB_SHADING_MAT) {
+ id= G.buts->lockpoin;
+ ma= G.buts->lockpoin;
+ if(id) {
+ event= pupmenu("Delete Key %t|RGB%x0|Alpha%x1|Halo Size%x2|Mode %x3|All Color%x10|All Mirror%x14|Ofs%x12|Size%x13|All Mapping%x11");
+ if(event== -1) return;
+
+ map= texchannel_to_adrcode(ma->texact);
+
+ if(event==0 || event==10) {
+ deletekey(id, ID_MA, NULL, NULL, MA_COL_R);
+ deletekey(id, ID_MA, NULL, NULL, MA_COL_G);
+ deletekey(id, ID_MA, NULL, NULL, MA_COL_B);
+ }
+ if(event==1 || event==10) {
+ deletekey(id, ID_MA, NULL, NULL, MA_ALPHA);
+ }
+ if(event==2 || event==10) {
+ deletekey(id, ID_MA, NULL, NULL, MA_HASIZE);
+ }
+ if(event==3 || event==10) {
+ deletekey(id, ID_MA, NULL, NULL, MA_MODE);
+ }
+ if(event==10) {
+ deletekey(id, ID_MA, NULL, NULL, MA_SPEC_R);
+ deletekey(id, ID_MA, NULL, NULL, MA_SPEC_G);
+ deletekey(id, ID_MA, NULL, NULL, MA_SPEC_B);
+ deletekey(id, ID_MA, NULL, NULL, MA_REF);
+ deletekey(id, ID_MA, NULL, NULL, MA_EMIT);
+ deletekey(id, ID_MA, NULL, NULL, MA_AMB);
+ deletekey(id, ID_MA, NULL, NULL, MA_SPEC);
+ deletekey(id, ID_MA, NULL, NULL, MA_HARD);
+ deletekey(id, ID_MA, NULL, NULL, MA_MODE);
+ deletekey(id, ID_MA, NULL, NULL, MA_TRANSLU);
+ deletekey(id, ID_MA, NULL, NULL, MA_ADD);
+ }
+ if(event==14) {
+ deletekey(id, ID_MA, NULL, NULL, MA_RAYM);
+ deletekey(id, ID_MA, NULL, NULL, MA_FRESMIR);
+ deletekey(id, ID_MA, NULL, NULL, MA_FRESMIRI);
+ deletekey(id, ID_MA, NULL, NULL, MA_FRESTRA);
+ deletekey(id, ID_MA, NULL, NULL, MA_FRESTRAI);
+ }
+ if(event==12 || event==11) {
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_OFS_X);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_OFS_Y);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_OFS_Z);
+ }
+ if(event==13 || event==11) {
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_SIZE_X);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_SIZE_Y);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_SIZE_Z);
+ }
+ if(event==11) {
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_R);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_G);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_B);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_DVAR);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_COLF);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_NORF);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_VARF);
+ deletekey(id, ID_MA, NULL, NULL, map+MAP_DISP);
+ }
+ }
+ }
+ else if(tab==TAB_SHADING_WORLD) {
+ id= G.buts->lockpoin;
+ wo= G.buts->lockpoin;
+ if(id) {
+ event= pupmenu("Delete Key %t|Zenith RGB%x0|Horizon RGB%x1|Mist%x2|Stars %x3|Offset%x12|Size%x13");
+ if(event== -1) return;
+
+ map= texchannel_to_adrcode(wo->texact);
+
+ if(event==0) {
+ deletekey(id, ID_WO, NULL, NULL, WO_ZEN_R);
+ deletekey(id, ID_WO, NULL, NULL, WO_ZEN_G);
+ deletekey(id, ID_WO, NULL, NULL, WO_ZEN_B);
+ }
+ if(event==1) {
+ deletekey(id, ID_WO, NULL, NULL, WO_HOR_R);
+ deletekey(id, ID_WO, NULL, NULL, WO_HOR_G);
+ deletekey(id, ID_WO, NULL, NULL, WO_HOR_B);
+ }
+ if(event==2) {
+ deletekey(id, ID_WO, NULL, NULL, WO_MISI);
+ deletekey(id, ID_WO, NULL, NULL, WO_MISTDI);
+ deletekey(id, ID_WO, NULL, NULL, WO_MISTSTA);
+ deletekey(id, ID_WO, NULL, NULL, WO_MISTHI);
+ }
+ if(event==3) {
+ deletekey(id, ID_WO, NULL, NULL, WO_STAR_R);
+ deletekey(id, ID_WO, NULL, NULL, WO_STAR_G);
+ deletekey(id, ID_WO, NULL, NULL, WO_STAR_B);
+ deletekey(id, ID_WO, NULL, NULL, WO_STARDIST);
+ deletekey(id, ID_WO, NULL, NULL, WO_STARSIZE);
+ }
+ if(event==12) {
+ deletekey(id, ID_WO, NULL, NULL, map+MAP_OFS_X);
+ deletekey(id, ID_WO, NULL, NULL, map+MAP_OFS_Y);
+ deletekey(id, ID_WO, NULL, NULL, map+MAP_OFS_Z);
+ }
+ if(event==13) {
+ deletekey(id, ID_WO, NULL, NULL, map+MAP_SIZE_X);
+ deletekey(id, ID_WO, NULL, NULL, map+MAP_SIZE_Y);
+ deletekey(id, ID_WO, NULL, NULL, map+MAP_SIZE_Z);
+ }
+ }
+ }
+ else if(tab==TAB_SHADING_LAMP) {
+ id= G.buts->lockpoin;
+ la= G.buts->lockpoin;
+ if(id) {
+ event= pupmenu("Delete Key %t|RGB%x0|Energy%x1|Spot Size%x2|Offset%x12|Size%x13");
+ if(event== -1) return;
+
+ map= texchannel_to_adrcode(la->texact);
+
+ if(event==0) {
+ deletekey(id, ID_LA, NULL, NULL, LA_COL_R);
+ deletekey(id, ID_LA, NULL, NULL, LA_COL_G);
+ deletekey(id, ID_LA, NULL, NULL, LA_COL_B);
+ }
+ if(event==1) {
+ deletekey(id, ID_LA, NULL, NULL, LA_ENERGY);
+ }
+ if(event==2) {
+ deletekey(id, ID_LA, NULL, NULL, LA_SPOTSI);
+ }
+ if(event==12) {
+ deletekey(id, ID_LA, NULL, NULL, map+MAP_OFS_X);
+ deletekey(id, ID_LA, NULL, NULL, map+MAP_OFS_Y);
+ deletekey(id, ID_LA, NULL, NULL, map+MAP_OFS_Z);
+ }
+ if(event==13) {
+ deletekey(id, ID_LA, NULL, NULL, map+MAP_SIZE_X);
+ deletekey(id, ID_LA, NULL, NULL, map+MAP_SIZE_Y);
+ deletekey(id, ID_LA, NULL, NULL, map+MAP_SIZE_Z);
+ }
+
+ }
+ }
+ else if(tab==TAB_SHADING_TEX) {
+ id= G.buts->lockpoin;
+ te= G.buts->lockpoin;
+ if(id) {
+ event= pupmenu("Delete Key %t|Cloud%x0|Mable%x1|Stucci%x2|Wood%x3|Magic%x4|Blend%x5|Musgrave%x6|Voronoi%x7|Distnoise%x8|ColourFilter%x9");
+ if(event== -1) return;
+
+ if(event==0) {
+ deletekey(id, ID_TE, NULL, NULL, TE_NSIZE);
+ deletekey(id, ID_TE, NULL, NULL, TE_NDEPTH);
+ deletekey(id, ID_TE, NULL, NULL, TE_NTYPE);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_TYP);
+ deletekey(id, ID_TE, NULL, NULL, TE_N_BAS1);
+ }
+ if(event==1) {
+ deletekey(id, ID_TE, NULL, NULL, TE_NSIZE);
+ deletekey(id, ID_TE, NULL, NULL, TE_NDEPTH);
+ deletekey(id, ID_TE, NULL, NULL, TE_NTYPE);
+ deletekey(id, ID_TE, NULL, NULL, TE_TURB);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_TYP);
+ deletekey(id, ID_TE, NULL, NULL, TE_N_BAS1);
+ deletekey(id, ID_TE, NULL, NULL, TE_N_BAS2);
+ }
+ if(event==2) {
+ deletekey(id, ID_TE, NULL, NULL, TE_NSIZE);
+ deletekey(id, ID_TE, NULL, NULL, TE_NTYPE);
+ deletekey(id, ID_TE, NULL, NULL, TE_TURB);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_TYP);
+ deletekey(id, ID_TE, NULL, NULL, TE_N_BAS1);
+ }
+ if(event==3) {
+ deletekey(id, ID_TE, NULL, NULL, TE_NSIZE);
+ deletekey(id, ID_TE, NULL, NULL, TE_NTYPE);
+ deletekey(id, ID_TE, NULL, NULL, TE_TURB);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_TYP);
+ deletekey(id, ID_TE, NULL, NULL, TE_N_BAS1);
+ deletekey(id, ID_TE, NULL, NULL, TE_N_BAS2);
+ }
+ if(event==4) {
+ deletekey(id, ID_TE, NULL, NULL, TE_NDEPTH);
+ deletekey(id, ID_TE, NULL, NULL, TE_TURB);
+ }
+ if(event==5) {
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_TYP);
+ }
+ if(event==6) {
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_TYP);
+ deletekey(id, ID_TE, NULL, NULL, TE_MGH);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_LAC);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_OCT);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_OFF);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_GAIN);
+ }
+ if(event==7) {
+ deletekey(id, ID_TE, NULL, NULL, TE_VNW1);
+ deletekey(id, ID_TE, NULL, NULL, TE_VNW2);
+ deletekey(id, ID_TE, NULL, NULL, TE_VNW3);
+ deletekey(id, ID_TE, NULL, NULL, TE_VNW4);
+ deletekey(id, ID_TE, NULL, NULL, TE_VNMEXP);
+ deletekey(id, ID_TE, NULL, NULL, TE_VN_DISTM);
+ deletekey(id, ID_TE, NULL, NULL, TE_VN_COLT);
+ deletekey(id, ID_TE, NULL, NULL, TE_ISCA);
+ deletekey(id, ID_TE, NULL, NULL, TE_NSIZE);
+ }
+ if(event==8) {
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_OCT);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_OFF);
+ deletekey(id, ID_TE, NULL, NULL, TE_MG_GAIN);
+ deletekey(id, ID_TE, NULL, NULL, TE_DISTA);
+ }
+ if(event==9) {
+ deletekey(id, ID_TE, NULL, NULL, TE_COL_R);
+ deletekey(id, ID_TE, NULL, NULL, TE_COL_G);
+ deletekey(id, ID_TE, NULL, NULL, TE_COL_B);
+ deletekey(id, ID_TE, NULL, NULL, TE_BRIGHT);
+ deletekey(id, ID_TE, NULL, NULL, TE_CONTRA);
+ }
+ }
+ }
+ }
+ else if(G.buts->mainb==CONTEXT_OBJECT) {
+ ob= OBACT;
+ if(ob && ob->type==OB_MESH) {
+ id= (ID *) (ob);
+ if(id) {
+ event= pupmenu("Delete Key %t|Surface Damping%x0|Random Damping%x1|Permeability%x2|Force Strength%x3|Force Falloff%x4");
+ if(event== -1) return;
+
+ if(event==0) {
+ deletekey(id, ID_OB, NULL, NULL, OB_PD_SDAMP);
+ }
+ if(event==1) {
+ deletekey(id, ID_OB, NULL, NULL, OB_PD_RDAMP);
+ }
+ if(event==2) {
+ deletekey(id, ID_OB, NULL, NULL, OB_PD_PERM);
+ }
+ if(event==3) {
+ deletekey(id, ID_OB, NULL, NULL, OB_PD_FSTR);
+ }
+ if(event==4) {
+ deletekey(id, ID_OB, NULL, NULL, OB_PD_FFALL);
+ }
+
+ }
+ }
+ }
+ else if(G.buts->mainb==CONTEXT_EDITING) {
+ ob= OBACT;
+ if(ob && ob->type==OB_CAMERA) {
+ id= G.buts->lockpoin;
+ if(id) {
+ /* yafray: delete key extended with aperture and focal distance ? */
+ if (G.scene->r.renderer==R_INTERN)
+ event= pupmenu("Delete Key %t|Lens%x0|Clipping%x1");
+ else
+ event= pupmenu("Delete Key %t|Lens%x0|Clipping%x1|Aperture%x2|FocalDistance%x3");
+ if(event== -1) return;
+
+ if(event==0) {
+ deletekey(id, ID_CA, NULL, NULL, CAM_LENS);
+ }
+ else if(event==1) {
+ deletekey(id, ID_CA, NULL, NULL, CAM_STA);
+ deletekey(id, ID_CA, NULL, NULL, CAM_END);
+ }
+ else if(event==2) {
+ deletekey(id, ID_CA, NULL, NULL, CAM_YF_APERT);
+ }
+ else if(event==3) {
+ deletekey(id, ID_CA, NULL, NULL, CAM_YF_FDIST);
+ }
+ }
+ }
+ }
+ else if(FALSE /* && G.buts->mainb==BUTS_SOUND */) {
+ if(G.ssound) {
+ id= G.buts->lockpoin;
+ if(id) {
+ event= pupmenu("Delete Key %t|Volume%x0|Pitch%x1|Panning%x2|Attennuation%x3");
+ if(event== -1) return;
+
+ if(event==0) {
+ deletekey(id, ID_SO, NULL, NULL, SND_VOLUME);
+ }
+ if(event==1) {
+ deletekey(id, ID_SO, NULL, NULL, SND_PITCH);
+ }
+ if(event==2) {
+ deletekey(id, ID_SO, NULL, NULL, SND_PANNING);
+ }
+ if(event==3) {
+ deletekey(id, ID_SO, NULL, NULL, SND_ATTEN);
+ }
+ }
+ }
+ }
+
+ BIF_undo_push("Delete Key Buttons");
+
+ allspace(REDRAWVIEW3D, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue(REDRAWIPO, 0);
+ allspace(REMAKEIPO, 0);
+ }
+ else if(curarea->spacetype==SPACE_VIEW3D) {
+ ob= OBACT;
+
+ if (ob && (ob->flag & OB_POSEMODE)) {
+ strcpy(menustr, "Delete Key%t|Loc%x0|Rot%x1|Size%x2|LocRot%x3|LocRotSize%x4|Avail%x9|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13");
+ }
+ else {
+ base= FIRSTBASE;
+ while(base) {
+ if TESTBASELIB(base) break;
+ base= base->next;
+ }
+ if(base==NULL) return;
+ strcpy(menustr, "Delete Key%t|Loc%x0|Rot%x1|Size%x2|LocRot%x3|LocRotSize%x4|Layer%x5|Avail%x9|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13");
+ }
+
+ if(ob) {
+ if(ob->type==OB_MESH) strcat(menustr, "| %x6|Mesh%x7");
+ else if(ob->type==OB_LATTICE) strcat(menustr, "| %x6|Lattice%x7");
+ else if(ob->type==OB_CURVE) strcat(menustr, "| %x6|Curve%x7");
+ else if(ob->type==OB_SURF) strcat(menustr, "| %x6|Surface%x7");
+ }
+
+ event= pupmenu(menustr);
+ if(event== -1) return;
+
+ if(event==7) {
+ delete_key(ob);
+ return;
+ }
+
+ if (ob && (ob->flag & OB_POSEMODE)){
+ bPoseChannel *pchan;
+
+ if (ob->action && ob->action->id.lib) {
+ error ("Can't key libactions");
+ return;
+ }
+
+ set_pose_keys(ob); /* sets pchan->flag to POSE_KEY if bone selected */
+ id= &ob->id;
+ for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+ if (pchan->flag & POSE_KEY){
+ if(event==0 || event==3 ||event==4) {
+ deletekey(id, ID_PO, pchan->name, NULL, AC_LOC_X);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_LOC_Y);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_LOC_Z);
+ }
+ if(event==1 || event==3 ||event==4) {
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_X);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_W);
+ }
+ if(event==2 || event==4) {
+ deletekey(id, ID_PO, pchan->name, NULL, AC_SIZE_X);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
+ }
+ if (event==9 && ob->action) {
+ bActionChannel *achan;
+
+ for (achan = ob->action->chanbase.first; achan; achan=achan->next){
+ if (achan->ipo && !strcmp (achan->name, pchan->name)){
+ for (icu = achan->ipo->curve.first; icu; icu=icu->next){
+ deletekey(id, ID_PO, achan->name, NULL, icu->adrcode);
+ }
+ break;
+ }
+ }
+ }
+ if(event==11 || event==13) {
+ deletekey(id, ID_PO, pchan->name, NULL, AC_LOC_X);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_LOC_Y);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_LOC_Z);
+ }
+ if(event==12 || event==13) {
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_W);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_X);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
+ deletekey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
+ }
+ }
+ }
+ if(ob->action)
+ remake_action_ipos(ob->action);
+
+ allspace(REDRAWVIEW3D, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ }
+ else {
+ for(base=FIRSTBASE; base; base=base->next) {
+ char *actname= NULL;
+
+ if (!TESTBASELIB(base))
+ continue;
+
+ id= (ID *)(base->object);
+
+ if(ob->ipoflag & OB_ACTION_OB)
+ actname= "Object";
+
+ /* all curves in ipo deselect */
+ if(base->object->ipo) {
+ icu= base->object->ipo->curve.first;
+ while(icu) {
+ icu->flag &= ~IPO_SELECT;
+ if(event==9)
+ deletekey(id, ID_OB, actname, NULL, icu->adrcode);
+ icu= icu->next;
+ }
+ }
+
+ if(event==0 || event==3 ||event==4) {
+ deletekey(id, ID_OB, actname, NULL, OB_LOC_X);
+ deletekey(id, ID_OB, actname, NULL, OB_LOC_Y);
+ deletekey(id, ID_OB, actname, NULL, OB_LOC_Z);
+ }
+ if(event==1 || event==3 ||event==4) {
+ deletekey(id, ID_OB, actname, NULL, OB_ROT_X);
+ deletekey(id, ID_OB, actname, NULL, OB_ROT_Y);
+ deletekey(id, ID_OB, actname, NULL, OB_ROT_Z);
+ }
+ if(event==2 || event==4) {
+ deletekey(id, ID_OB, actname, NULL, OB_SIZE_X);
+ deletekey(id, ID_OB, actname, NULL, OB_SIZE_Y);
+ deletekey(id, ID_OB, actname, NULL, OB_SIZE_Z);
+ }
+ if(event==5) {
+ /* remove localview */
+ tlay= base->object->lay;
+ base->object->lay &= 0xFFFFFF;
+ deletekey(id, ID_OB, actname, NULL, OB_LAY);
+ base->object->lay= tlay;
+ }
+ if(event==11 || event==13) {
+ deletekey(id, ID_OB, actname, NULL, OB_LOC_X);
+ deletekey(id, ID_OB, actname, NULL, OB_LOC_Y);
+ deletekey(id, ID_OB, actname, NULL, OB_LOC_Z);
+ }
+ if(event==12 || event==13) {
+ deletekey(id, ID_OB, actname, NULL, OB_ROT_X);
+ deletekey(id, ID_OB, actname, NULL, OB_ROT_Y);
+ deletekey(id, ID_OB, actname, NULL, OB_ROT_Z);
+ }
+ }
+ }
+
+ if(event==0) BIF_undo_push("Delete Loc Key");
+ else if(event==1) BIF_undo_push("Delete Rot Key");
+ else if(event==2) BIF_undo_push("Delete Size Key");
+ else if(event==3) BIF_undo_push("Delete LocRot Key");
+ else if(event==4) BIF_undo_push("Delete LocRotSize Key");
+ else if(event==5) BIF_undo_push("Delete Layer Key");
+ else if(event==7) BIF_undo_push("Delete Vertex Key");
+ else if(event==9) BIF_undo_push("Delete Avail Key");
+
+ allspace(REMAKEIPO, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ }
+}
+
/* ****************************************************************************** */
void add_duplicate_editipo(void)
Index: source/blender/src/header_view3d.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/header_view3d.c,v
retrieving revision 1.165
diff -u -r1.165 header_view3d.c
--- source/blender/src/header_view3d.c 2 Apr 2006 15:40:56 -0000 1.165
+++ source/blender/src/header_view3d.c 14 Apr 2006 16:59:42 -0000
@@ -2022,6 +2022,9 @@
case 11: /* insert keyframe */
common_insertkey();
break;
+ case 12: /* delete keyframe */
+ common_deletekey();
+ break;
case 15: /* Object Panel */
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
break;
@@ -2047,6 +2050,7 @@
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -2553,6 +2557,9 @@
if(G.scene->proportional) G.scene->proportional= 0;
else G.scene->proportional= 1;
break;
+ case 13: /* delete keyframe */
+ common_deletekey();
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -2580,6 +2587,7 @@
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delte Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -2762,6 +2770,9 @@
case 2: /* insert keyframe */
common_insertkey();
break;
+ case 3: /* delete keyframe */
+ common_deletekey();
+ break;
case 4: /* extrude */
if (OBACT->type == OB_CURVE) {
addvert_Nurb('e');
@@ -2818,6 +2829,7 @@
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -3124,6 +3136,9 @@
if(G.scene->proportional) G.scene->proportional= 0;
else G.scene->proportional= 1;
break;
+ case 6: /* delete keyframe */
+ common_deletekey();
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -3147,6 +3162,7 @@
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -3482,6 +3498,9 @@
}
}
break;
+ case 14: /* delete keyframe */
+ common_deletekey();
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -3502,6 +3521,7 @@
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
Index: source/blender/src/toets.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/toets.c,v
retrieving revision 1.71
diff -u -r1.71 toets.c
--- source/blender/src/toets.c 10 Feb 2006 21:10:58 -0000 1.71
+++ source/blender/src/toets.c 14 Apr 2006 16:59:47 -0000
@@ -680,6 +680,10 @@
if(textediting==0 && textspace==0 && curarea->spacetype!=SPACE_FILE && curarea->spacetype!=SPACE_IMASEL) {
if(G.qual==0) {
common_insertkey();
+ return 0;
+ }
+ else if (G.qual == LR_ALTKEY) {
+ common_deletekey();
return 0;
}
}
Index: source/blender/src/toolbox.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/toolbox.c,v
retrieving revision 1.128
diff -u -r1.128 toolbox.c
--- source/blender/src/toolbox.c 25 Mar 2006 04:37:40 -0000 1.128
+++ source/blender/src/toolbox.c 14 Apr 2006 16:59:49 -0000
@@ -1024,12 +1024,14 @@
case 3: G.f ^= G_DRAWFACES; break;
case 4: G.f ^= G_DRAWNORMALS; break;
case 5: flip_subdivison(OBACT, -1); break;
+ case 6: common_deletekey(); break;
}
addqueue(curarea->win, REDRAW, 1);
}
static TBitem tb_mesh[]= {
{ 0, "Insert Keyframe|I", 1, NULL},
+{ 0, "Delete Keyframe|Alt I", 6, NULL},
{ 0, "SEPR", 0, NULL},
{ 0, "Show/Hide Edges", 2, NULL},
{ 0, "Show/Hide Faces", 3, NULL},

Event Timeline