diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-27 07:33:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-27 07:34:54 +0300 |
commit | d74957d38c1eeec241c76f21d790c196375ca0e4 (patch) | |
tree | 10fb67205265f538b62e036ae7003b14722ba0cc /source/blender | |
parent | ed0db62a3dafc6040a998b605f0f48084f013994 (diff) |
Fix mask active-point being lost on load/undo
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ca367d8d06b..1b0dfb7e431 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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; } } |