Fix mask active-point being lost on load/undo
This commit is contained in:
@@ -7447,9 +7447,13 @@ static void direct_link_mask(FileData *fd, Mask *mask)
|
||||
MaskSpline *spline;
|
||||
MaskLayerShape *masklay_shape;
|
||||
|
||||
/* can't use newdataadr since it's a pointer within an array */
|
||||
MaskSplinePoint *act_point_search = NULL;
|
||||
|
||||
link_list(fd, &masklay->splines);
|
||||
|
||||
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||
MaskSplinePoint *points_old = spline->points;
|
||||
int i;
|
||||
|
||||
spline->points = newdataadr(fd, spline->points);
|
||||
@@ -7460,6 +7464,14 @@ static void direct_link_mask(FileData *fd, Mask *mask)
|
||||
if (point->tot_uw)
|
||||
point->uw = newdataadr(fd, point->uw);
|
||||
}
|
||||
|
||||
/* detect active point */
|
||||
if ((act_point_search == NULL) &&
|
||||
(masklay->act_point >= points_old) &&
|
||||
(masklay->act_point < points_old + spline->tot_point))
|
||||
{
|
||||
act_point_search = &spline->points[masklay->act_point - points_old];
|
||||
}
|
||||
}
|
||||
|
||||
link_list(fd, &masklay->splines_shapes);
|
||||
@@ -7477,7 +7489,7 @@ static void direct_link_mask(FileData *fd, Mask *mask)
|
||||
}
|
||||
|
||||
masklay->act_spline = newdataadr(fd, masklay->act_spline);
|
||||
masklay->act_point = newdataadr(fd, masklay->act_point);
|
||||
masklay->act_point = act_point_search;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user