rna/api: new bezier keys added via fcu.keyframe_points.add() now use auto handles and bezier interpolation.

This commit is contained in:
2011-03-13 09:52:49 +00:00
parent cf8cc39d4c
commit 4cfa5d55e6

View File

@@ -561,6 +561,7 @@ static BezTriple *rna_FKeyframe_points_insert(FCurve *fcu, float frame, float va
static void rna_FKeyframe_points_add(FCurve *fcu, int tot) static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
{ {
if(tot > 0) { if(tot > 0) {
BezTriple *bezt;
if(fcu->totvert) { if(fcu->totvert) {
BezTriple *nbezt= MEM_callocN(sizeof(BezTriple) * (fcu->totvert + tot), "rna_FKeyframe_points_add"); BezTriple *nbezt= MEM_callocN(sizeof(BezTriple) * (fcu->totvert + tot), "rna_FKeyframe_points_add");
memcpy(nbezt, fcu->bezt, sizeof(BezTriple) * fcu->totvert); memcpy(nbezt, fcu->bezt, sizeof(BezTriple) * fcu->totvert);
@@ -571,7 +572,16 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
fcu->bezt= MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add"); fcu->bezt= MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add");
} }
bezt= fcu->bezt + fcu->totvert;
fcu->totvert += tot; fcu->totvert += tot;
while(tot--) {
/* defaults, no userprefs gives pradictable results for API */
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->ipo= BEZT_IPO_BEZ;
bezt->h1= bezt->h2= HD_AUTO;
bezt++;
}
} }
} }