[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47575] trunk/blender/source/blender/ editors/mask/mask_add.c: adding mask points now adds in the correct place relative to shape keys ( updating other keys for the new points still needs work though)

Campbell Barton ideasman42 at gmail.com
Thu Jun 7 17:33:37 CEST 2012


Revision: 47575
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47575
Author:   campbellbarton
Date:     2012-06-07 15:33:32 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
adding mask points now adds in the correct place relative to shape keys (updating other keys for the new points still needs work though)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mask/mask_add.c

Modified: trunk/blender/source/blender/editors/mask/mask_add.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_add.c	2012-06-07 15:25:14 UTC (rev 47574)
+++ trunk/blender/source/blender/editors/mask/mask_add.c	2012-06-07 15:33:32 UTC (rev 47575)
@@ -54,7 +54,8 @@
 
 static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather,
                                    MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
-                                   float *u_r, float tangent[2])
+                                   float *u_r, float tangent[2],
+                                   const short use_deform)
 {
 	MaskLayer *masklay, *point_masklay;
 	MaskSpline *point_spline;
@@ -80,9 +81,12 @@
 
 		for (spline = masklay->splines.first; spline; spline = spline->next) {
 			int i;
+			MaskSplinePoint *cur_point;
 
-			for (i = 0; i < spline->tot_point; i++) {
-				MaskSplinePoint *cur_point = &spline->points[i];
+			for (i = 0, cur_point = use_deform ? spline->points_deform : spline->points;
+			     i < spline->tot_point;
+			     i++, cur_point++)
+			{
 				float *diff_points;
 				int tot_diff_point;
 
@@ -123,7 +127,7 @@
 
 							point_masklay = masklay;
 							point_spline = spline;
-							point = cur_point;
+							point = use_deform ? &spline->points[(cur_point - spline->points_deform)] : cur_point;
 							dist = cur_dist;
 							u = (float)i / tot_point;
 
@@ -370,7 +374,7 @@
 	float tangent[2];
 	float u;
 
-	if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &masklay, &spline, &point, &u, tangent)) {
+	if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &masklay, &spline, &point, &u, tangent, TRUE)) {
 		MaskSplinePoint *new_point;
 		int point_index = point - spline->points;
 
@@ -651,7 +655,7 @@
 	if (point)
 		return OPERATOR_FINISHED;
 
-	if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &masklay, &spline, &point, &u, NULL)) {
+	if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &masklay, &spline, &point, &u, NULL, TRUE)) {
 		Scene *scene = CTX_data_scene(C);
 		float w = BKE_mask_point_weight(spline, point, u);
 		float weight_scalar = BKE_mask_point_weight_scalar(spline, point, u);




More information about the Bf-blender-cvs mailing list