[Bf-blender-cvs] [d74957d] master: Fix mask active-point being lost on load/undo

Campbell Barton noreply at git.blender.org
Wed Apr 27 06:31:42 CEST 2016


Commit: d74957d38c1eeec241c76f21d790c196375ca0e4
Author: Campbell Barton
Date:   Wed Apr 27 14:33:51 2016 +1000
Branches: master
https://developer.blender.org/rBd74957d38c1eeec241c76f21d790c196375ca0e4

Fix mask active-point being lost on load/undo

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ca367d8..1b0dfb7 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;
 	}
 }




More information about the Bf-blender-cvs mailing list