A few code cleanups for the IPO cleaning stuff in an attempt to get rid

of a bug which hides all but the active ipo-curve after cleaning. The bug
still remains, but I hope to have a solution soon.
This commit is contained in:
Joshua Leung 2007-01-04 22:35:19 +00:00
parent 834495b5ff
commit 8039ad32df
4 changed files with 25 additions and 26 deletions

@ -92,7 +92,7 @@ void insert_vert_ipo(struct IpoCurve *icu, float x, float y);
void add_vert_ipo(void);
void add_duplicate_editipo(void);
void remove_doubles_ipo(void);
void clean_ipo(struct Ipo *ipo, short mode);
void clean_ipo(void);
void clean_ipo_curve(struct IpoCurve *icu);
void smooth_ipo(void);
void join_ipo_menu(void);

@ -3078,11 +3078,11 @@ void remove_doubles_ipo(void)
}
void clean_ipo(Ipo *ipo, short mode)
void clean_ipo(void)
{
/* fixme: this should probably work on editipo's as well... - aligorith*/
IpoCurve *icu;
int ok;
EditIpo *ei;
short ok;
int b;
if (G.scene->toolsettings->clean_thresh==0)
G.scene->toolsettings->clean_thresh= 0.1f;
@ -3091,24 +3091,26 @@ void clean_ipo(Ipo *ipo, short mode)
"Clean Threshold");
if (!ok) return;
for (icu= ipo->curve.first; icu; icu= icu->next) {
switch (mode) {
case 1: /* only selected curves get affected */
if ((icu->flag & IPO_SELECT)||(icu->flag & IPO_ACTIVE)) {
clean_ipo_curve(icu);
}
break;
default: /* any curve gets affected */
clean_ipo_curve(icu);
break;
get_status_editipo();
ei= G.sipo->editipo;
for(b=0; b<G.sipo->totipo; b++, ei++) {
if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
ok= 0;
if(G.sipo->showkey) ok= 1;
else if(totipo_vert && (ei->flag & IPO_EDIT)) ok= 2;
else if(totipo_vert==0 && (ei->flag & IPO_SELECT)) ok= 3;
if(ok) {
/* only clean if ok */
clean_ipo_curve(ei->icu);
}
}
}
editipo_changed(G.sipo, 1);
BIF_undo_push("Clean IPO");
allqueue(REMAKEIPO, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
}
void clean_ipo_curve(IpoCurve *icu)
@ -3131,7 +3133,7 @@ void clean_ipo_curve(IpoCurve *icu)
thresh= 0.1f;
/* pointers to points */
newb = newbs = MEM_mallocN(sizeof(BezTriple)*totCount, "NewBeztriples");
newb = newbs = MEM_callocN(sizeof(BezTriple)*totCount, "NewBeztriples");
bezt= icu->bezt;
*newb= *bezt;
bezt++;
@ -3200,7 +3202,7 @@ void clean_ipo_curve(IpoCurve *icu)
}
/* make better sized list */
newbz= MEM_mallocN(sizeof(BezTriple)*newCount, "BezTriples");
newbz= MEM_callocN(sizeof(BezTriple)*newCount, "BezTriples");
for (i=0; i<newCount; i++) {
BezTriple *atar, *bsrc;
atar= (newbz + i);

@ -581,10 +581,7 @@ static void do_ipo_editmenu(void *arg, int event)
sethandles_ipo(HD_AUTO_ANIM);
break;
case 8: /* clean ipo */
{
SpaceIpo *sipo= curarea->spacedata.first;
clean_ipo(sipo->ipo, 1);
}
clean_ipo();
break;
case 9: /* smooth ipo */
smooth_ipo();

@ -2606,7 +2606,7 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if (G.qual==LR_SHIFTKEY)
smooth_ipo();
else
clean_ipo(sipo->ipo, 1);
clean_ipo();
break;
case RKEY:
if (G.qual==0)