Fix T91766: NLA Editor - Segmentation fault on strip resize
NLA and Dope Sheet use a specific transform operation to scale. Unlike the conventional resize operation, `TIME_SCALE` operates on `td->val`. This is a bit outside the convention of transform operators. The expected thing in this case would be to work in `td->loc` and use the conventional resize operator. But for now, to fix the problem, use `td->loc` in the `TIME_SCALE` operation. This commit also brings a cleanup in the style of some comments and removing unnecessary `memset`.
This commit is contained in:
parent
3674347849
commit
3e78c9e5bb
Notes:
blender-bot
2023-02-14 05:37:19 +01:00
Referenced by issue #91766, NLA Editor - Segmentation fault on strip resize
|
@ -208,30 +208,18 @@ void createTransNlaData(bContext *C, TransInfo *t)
|
|||
/* just set tdn to assume that it only has one handle for now */
|
||||
tdn->handle = -1;
|
||||
|
||||
/* now, link the transform data up to this data */
|
||||
/* Now, link the transform data up to this data. */
|
||||
td->loc = tdn->h1;
|
||||
copy_v3_v3(td->iloc, tdn->h1);
|
||||
|
||||
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
|
||||
td->loc = tdn->h1;
|
||||
copy_v3_v3(td->iloc, tdn->h1);
|
||||
|
||||
/* store all the other gunk that is required by transform */
|
||||
/* Store all the other gunk that is required by transform. */
|
||||
copy_v3_v3(td->center, center);
|
||||
memset(td->axismtx, 0, sizeof(td->axismtx));
|
||||
td->axismtx[2][2] = 1.0f;
|
||||
|
||||
td->ext = NULL;
|
||||
td->val = NULL;
|
||||
|
||||
td->flag |= TD_SELECTED;
|
||||
td->dist = 0.0f;
|
||||
|
||||
unit_m3(td->mtx);
|
||||
unit_m3(td->smtx);
|
||||
}
|
||||
else {
|
||||
/* time scaling only needs single value */
|
||||
td->val = &tdn->h1[0];
|
||||
td->ival = tdn->h1[0];
|
||||
}
|
||||
|
||||
td->extra = tdn;
|
||||
td++;
|
||||
|
@ -241,30 +229,18 @@ void createTransNlaData(bContext *C, TransInfo *t)
|
|||
* then we're doing both, otherwise, only end */
|
||||
tdn->handle = (tdn->handle) ? 2 : 1;
|
||||
|
||||
/* now, link the transform data up to this data */
|
||||
/* Now, link the transform data up to this data. */
|
||||
td->loc = tdn->h2;
|
||||
copy_v3_v3(td->iloc, tdn->h2);
|
||||
|
||||
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
|
||||
td->loc = tdn->h2;
|
||||
copy_v3_v3(td->iloc, tdn->h2);
|
||||
|
||||
/* store all the other gunk that is required by transform */
|
||||
/* Store all the other gunk that is required by transform. */
|
||||
copy_v3_v3(td->center, center);
|
||||
memset(td->axismtx, 0, sizeof(td->axismtx));
|
||||
td->axismtx[2][2] = 1.0f;
|
||||
|
||||
td->ext = NULL;
|
||||
td->val = NULL;
|
||||
|
||||
td->flag |= TD_SELECTED;
|
||||
td->dist = 0.0f;
|
||||
|
||||
unit_m3(td->mtx);
|
||||
unit_m3(td->smtx);
|
||||
}
|
||||
else {
|
||||
/* time scaling only needs single value */
|
||||
td->val = &tdn->h2[0];
|
||||
td->ival = tdn->h2[0];
|
||||
}
|
||||
|
||||
td->extra = tdn;
|
||||
td++;
|
||||
|
|
|
@ -87,7 +87,7 @@ static void applyTimeScaleValue(TransInfo *t, float value)
|
|||
}
|
||||
|
||||
/* now, calculate the new value */
|
||||
*(td->val) = ((td->ival - startx) * fac) + startx;
|
||||
td->loc[0] = ((td->iloc[0] - startx) * fac) + startx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue