Transform Convert Action: conventionalize TransData creation
`td2d->loc`, `td2d->loc2d`, `td->loc` and `td->iloc` were not being initialized as is done with the other conversion types. This avoids problems with transform modes becoming incompatible. This avoids problems with incompatible transform modes that could result in a crash.
This commit is contained in:
parent
85b044b3ef
commit
119d53263f
|
@ -140,19 +140,37 @@ static int count_masklayer_frames(MaskLayer *masklay, char side, float cfra, boo
|
|||
}
|
||||
|
||||
/* This function assigns the information to transdata */
|
||||
static void TimeToTransData(TransData *td, float *time, AnimData *adt, float ypos)
|
||||
static void TimeToTransData(
|
||||
TransData *td, TransData2D *td2d, BezTriple *bezt, AnimData *adt, float ypos)
|
||||
{
|
||||
/* memory is calloc'ed, so that should zero everything nicely for us */
|
||||
td->val = time;
|
||||
td->ival = *(time);
|
||||
float *time = bezt->vec[1];
|
||||
|
||||
/* Setup #TransData2D. */
|
||||
td2d->loc[0] = *time;
|
||||
td2d->loc2d = time;
|
||||
td2d->h1 = bezt->vec[0];
|
||||
td2d->h2 = bezt->vec[2];
|
||||
copy_v2_v2(td2d->ih1, td2d->h1);
|
||||
copy_v2_v2(td2d->ih2, td2d->h2);
|
||||
|
||||
/* Setup #TransData. */
|
||||
td->loc = time; /* Usually #td2d->loc is used here. But this is for when the original location is
|
||||
not float[3]. */
|
||||
td->val = time;
|
||||
td->ival = td->iloc[0] = *(time);
|
||||
td->center[0] = td->ival;
|
||||
td->center[1] = ypos;
|
||||
|
||||
/* store the AnimData where this keyframe exists as a keyframe of the
|
||||
* active action as td->extra.
|
||||
*/
|
||||
/* Store the AnimData where this keyframe exists as a keyframe of the
|
||||
* active action as #td->extra. */
|
||||
td->extra = adt;
|
||||
|
||||
if (bezt->f2 & SELECT) {
|
||||
td->flag |= TD_SELECTED;
|
||||
}
|
||||
|
||||
/* Set flags to move handles as necessary. */
|
||||
td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2;
|
||||
}
|
||||
|
||||
/* This function advances the address to which td points to, so it must return
|
||||
|
@ -185,19 +203,7 @@ static TransData *ActionFCurveToTransData(TransData *td,
|
|||
* so can't use BEZT_ISSEL_ANY() macro */
|
||||
/* only add if on the right 'side' of the current frame */
|
||||
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
|
||||
TimeToTransData(td, bezt->vec[1], adt, ypos);
|
||||
|
||||
if (bezt->f2 & SELECT) {
|
||||
td->flag |= TD_SELECTED;
|
||||
}
|
||||
|
||||
/* Set flags to move handles as necessary. */
|
||||
td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2;
|
||||
td2d->h1 = bezt->vec[0];
|
||||
td2d->h2 = bezt->vec[2];
|
||||
|
||||
copy_v2_v2(td2d->ih1, td2d->h1);
|
||||
copy_v2_v2(td2d->ih2, td2d->h2);
|
||||
TimeToTransData(td, td2d, bezt, adt, ypos);
|
||||
|
||||
td++;
|
||||
td2d++;
|
||||
|
|
Loading…
Reference in New Issue