Node curves to maintain handle status after adding a control point

Node curves maintain handles status (normal, auto, vector) even after adding
a control point now. This makes the behavior the same as in case of removing a control
point. Previously the status of handles was reseted.
This commit is contained in:
Juho Vepsalainen
2007-12-26 17:04:21 +00:00
parent 1b95e2badd
commit 2daf4c978c

View File

@@ -167,18 +167,30 @@ void curvemap_remove(CurveMap *cuma, int flag)
void curvemap_insert(CurveMap *cuma, float x, float y)
{
CurveMapPoint *cmp= MEM_callocN((cuma->totpoint+1)*sizeof(CurveMapPoint), "curve points");
int a;
memcpy(cmp, cuma->curve, (cuma->totpoint)*sizeof(CurveMapPoint));
int a, b, foundloc= 0;
/* insert fragments of the old one and the new point to the new curve */
cuma->totpoint++;
for(a=0, b=0; a<cuma->totpoint; a++) {
if((x < cuma->curve[a].x) && !foundloc) {
cmp[a].x= x;
cmp[a].y= y;
cmp[a].flag= CUMA_SELECT;
foundloc= 1;
}
else {
cmp[a].x= cuma->curve[b].x;
cmp[a].y= cuma->curve[b].y;
cmp[a].flag= cuma->curve[b].flag;
cmp[a].flag &= ~CUMA_SELECT; /* make sure old points don't remain selected */
cmp[a].shorty= cuma->curve[b].shorty;
b++;
}
}
/* free old curve and replace it with new one */
MEM_freeN(cuma->curve);
cuma->curve= cmp;
cuma->curve[cuma->totpoint].x= x;
cuma->curve[cuma->totpoint].y= y;
cuma->curve[cuma->totpoint].flag = CUMA_SELECT;
for(a=0; a<cuma->totpoint; a++, cmp++)
cmp->flag= 0;
cuma->totpoint++;
}
void curvemap_reset(CurveMap *cuma, rctf *clipr)