forked from bartvdbraak/blender
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:
parent
834495b5ff
commit
8039ad32df
@ -92,7 +92,7 @@ void insert_vert_ipo(struct IpoCurve *icu, float x, float y);
|
|||||||
void add_vert_ipo(void);
|
void add_vert_ipo(void);
|
||||||
void add_duplicate_editipo(void);
|
void add_duplicate_editipo(void);
|
||||||
void remove_doubles_ipo(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 clean_ipo_curve(struct IpoCurve *icu);
|
||||||
void smooth_ipo(void);
|
void smooth_ipo(void);
|
||||||
void join_ipo_menu(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*/
|
EditIpo *ei;
|
||||||
IpoCurve *icu;
|
short ok;
|
||||||
int ok;
|
int b;
|
||||||
|
|
||||||
if (G.scene->toolsettings->clean_thresh==0)
|
if (G.scene->toolsettings->clean_thresh==0)
|
||||||
G.scene->toolsettings->clean_thresh= 0.1f;
|
G.scene->toolsettings->clean_thresh= 0.1f;
|
||||||
@ -3091,24 +3091,26 @@ void clean_ipo(Ipo *ipo, short mode)
|
|||||||
"Clean Threshold");
|
"Clean Threshold");
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
|
||||||
for (icu= ipo->curve.first; icu; icu= icu->next) {
|
get_status_editipo();
|
||||||
switch (mode) {
|
|
||||||
case 1: /* only selected curves get affected */
|
ei= G.sipo->editipo;
|
||||||
if ((icu->flag & IPO_SELECT)||(icu->flag & IPO_ACTIVE)) {
|
for(b=0; b<G.sipo->totipo; b++, ei++) {
|
||||||
clean_ipo_curve(icu);
|
if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
|
||||||
}
|
|
||||||
break;
|
ok= 0;
|
||||||
default: /* any curve gets affected */
|
if(G.sipo->showkey) ok= 1;
|
||||||
clean_ipo_curve(icu);
|
else if(totipo_vert && (ei->flag & IPO_EDIT)) ok= 2;
|
||||||
break;
|
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");
|
BIF_undo_push("Clean IPO");
|
||||||
allqueue(REMAKEIPO, 0);
|
|
||||||
allqueue(REDRAWIPO, 0);
|
|
||||||
allqueue(REDRAWACTION, 0);
|
|
||||||
allqueue(REDRAWNLA, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_ipo_curve(IpoCurve *icu)
|
void clean_ipo_curve(IpoCurve *icu)
|
||||||
@ -3131,7 +3133,7 @@ void clean_ipo_curve(IpoCurve *icu)
|
|||||||
thresh= 0.1f;
|
thresh= 0.1f;
|
||||||
|
|
||||||
/* pointers to points */
|
/* pointers to points */
|
||||||
newb = newbs = MEM_mallocN(sizeof(BezTriple)*totCount, "NewBeztriples");
|
newb = newbs = MEM_callocN(sizeof(BezTriple)*totCount, "NewBeztriples");
|
||||||
bezt= icu->bezt;
|
bezt= icu->bezt;
|
||||||
*newb= *bezt;
|
*newb= *bezt;
|
||||||
bezt++;
|
bezt++;
|
||||||
@ -3200,7 +3202,7 @@ void clean_ipo_curve(IpoCurve *icu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make better sized list */
|
/* make better sized list */
|
||||||
newbz= MEM_mallocN(sizeof(BezTriple)*newCount, "BezTriples");
|
newbz= MEM_callocN(sizeof(BezTriple)*newCount, "BezTriples");
|
||||||
for (i=0; i<newCount; i++) {
|
for (i=0; i<newCount; i++) {
|
||||||
BezTriple *atar, *bsrc;
|
BezTriple *atar, *bsrc;
|
||||||
atar= (newbz + i);
|
atar= (newbz + i);
|
||||||
|
@ -581,10 +581,7 @@ static void do_ipo_editmenu(void *arg, int event)
|
|||||||
sethandles_ipo(HD_AUTO_ANIM);
|
sethandles_ipo(HD_AUTO_ANIM);
|
||||||
break;
|
break;
|
||||||
case 8: /* clean ipo */
|
case 8: /* clean ipo */
|
||||||
{
|
clean_ipo();
|
||||||
SpaceIpo *sipo= curarea->spacedata.first;
|
|
||||||
clean_ipo(sipo->ipo, 1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 9: /* smooth ipo */
|
case 9: /* smooth ipo */
|
||||||
smooth_ipo();
|
smooth_ipo();
|
||||||
|
@ -2606,7 +2606,7 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
if (G.qual==LR_SHIFTKEY)
|
if (G.qual==LR_SHIFTKEY)
|
||||||
smooth_ipo();
|
smooth_ipo();
|
||||||
else
|
else
|
||||||
clean_ipo(sipo->ipo, 1);
|
clean_ipo();
|
||||||
break;
|
break;
|
||||||
case RKEY:
|
case RKEY:
|
||||||
if (G.qual==0)
|
if (G.qual==0)
|
||||||
|
Loading…
Reference in New Issue
Block a user