Fix T91219: Crash canceling scale keyframes in dope sheet grease pencil
Caused by {rBb0d9e6797fb8} Ideally `td->loc` should always be set and point to a 3d array.
This commit is contained in:
parent
2b4afcbb4c
commit
08acbdc1ff
Notes:
blender-bot
2023-02-14 10:21:11 +01:00
Referenced by issue #91219, Crash canceling scale keyframes in dope sheet grease pencil
|
@ -51,7 +51,10 @@
|
|||
|
||||
/* helper struct for gp-frame transforms */
|
||||
typedef struct tGPFtransdata {
|
||||
float val; /* where transdata writes transform */
|
||||
union {
|
||||
float val; /* where transdata writes transform */
|
||||
float loc[3]; /* #td->val and #td->loc share the same pointer. */
|
||||
};
|
||||
int *sdata; /* pointer to gpf->framenum */
|
||||
} tGPFtransdata;
|
||||
|
||||
|
@ -245,8 +248,8 @@ static int GPLayerToTransData(TransData *td,
|
|||
tfd->val = (float)gpf->framenum;
|
||||
tfd->sdata = &gpf->framenum;
|
||||
|
||||
td->val = td->loc = &tfd->val; /* XXX: It's not a 3d array. */
|
||||
td->ival = td->iloc[0] = (float)gpf->framenum;
|
||||
td->val = td->loc = &tfd->val;
|
||||
td->ival = td->iloc[0] = tfd->val;
|
||||
|
||||
td->center[0] = td->ival;
|
||||
td->center[1] = ypos;
|
||||
|
@ -279,16 +282,15 @@ static int MaskLayerToTransData(TransData *td,
|
|||
masklay_shape = masklay_shape->next) {
|
||||
if (is_prop_edit || (masklay_shape->flag & MASK_SHAPE_SELECT)) {
|
||||
if (FrameOnMouseSide(side, (float)masklay_shape->frame, cfra)) {
|
||||
/* memory is calloc'ed, so that should zero everything nicely for us */
|
||||
td->val = &tfd->val;
|
||||
td->ival = (float)masklay_shape->frame;
|
||||
tfd->val = (float)masklay_shape->frame;
|
||||
tfd->sdata = &masklay_shape->frame;
|
||||
|
||||
td->val = td->loc = &tfd->val;
|
||||
td->ival = td->iloc[0] = tfd->val;
|
||||
|
||||
td->center[0] = td->ival;
|
||||
td->center[1] = ypos;
|
||||
|
||||
tfd->val = (float)masklay_shape->frame;
|
||||
tfd->sdata = &masklay_shape->frame;
|
||||
|
||||
/* advance td now */
|
||||
td++;
|
||||
tfd++;
|
||||
|
|
|
@ -791,7 +791,7 @@ static void restoreElement(TransData *td)
|
|||
{
|
||||
transdata_restore_basic((TransDataBasic *)td);
|
||||
|
||||
if (td->val) {
|
||||
if (td->val && td->val != td->loc) {
|
||||
*td->val = td->ival;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue