From 3e78c9e5bb179e84d542bc698fc6f6d7c111d1e1 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 28 Sep 2021 10:23:57 -0300 Subject: 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`. --- .../editors/transform/transform_convert_nla.c | 44 +++++----------------- 1 file changed, 10 insertions(+), 34 deletions(-) (limited to 'source/blender/editors/transform/transform_convert_nla.c') diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index 7e5b80c2453..acef8a666e3 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -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 */ - if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) { - td->loc = tdn->h1; - copy_v3_v3(td->iloc, tdn->h1); + /* Now, link the transform data up to this data. */ + td->loc = tdn->h1; + copy_v3_v3(td->iloc, tdn->h1); - /* store all the other gunk that is required by transform */ + if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) { + /* 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 */ - if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) { - td->loc = tdn->h2; - copy_v3_v3(td->iloc, tdn->h2); + /* Now, link the transform data up to this data. */ + td->loc = tdn->h2; + copy_v3_v3(td->iloc, tdn->h2); - /* store all the other gunk that is required by transform */ + if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) { + /* 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++; -- cgit v1.2.3