[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47168] branches/soc-2011-tomato/source/ blender: fix for parent + animation handles.

Campbell Barton ideasman42 at gmail.com
Tue May 29 13:00:02 CEST 2012


Revision: 47168
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47168
Author:   campbellbarton
Date:     2012-05-29 11:00:02 +0000 (Tue, 29 May 2012)
Log Message:
-----------
fix for parent + animation handles.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h	2012-05-29 10:41:00 UTC (rev 47167)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h	2012-05-29 11:00:02 UTC (rev 47168)
@@ -101,6 +101,7 @@
 void BKE_mask_get_handle_point_adjacent(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point,
                                         struct MaskSplinePoint **r_point_prev, struct MaskSplinePoint **r_point_next);
 void BKE_mask_calc_handles(struct Mask *mask);
+void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
 
 /* animation */
 int  BKE_mask_object_shape_totvert(struct MaskObject *maskobj);

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-05-29 10:41:00 UTC (rev 47167)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-05-29 11:00:02 UTC (rev 47168)
@@ -893,7 +893,7 @@
 	float parent_co[2];
 
 	if (BKE_mask_evaluate_parent(parent, ctime, parent_co)) {
-		sub_v2_v2v2(r_delta, parent->parent_orig, parent_co);
+		sub_v2_v2v2(r_delta, parent_co, parent->parent_orig);
 		return TRUE;
 	}
 	else {
@@ -1107,6 +1107,11 @@
 
 			for (i = 0; i < spline->tot_point; i++) {
 				BKE_mask_calc_handle_point(mask, spline, &spline->points[i]);
+
+				/* could be done in a different function... */
+				if (spline->points_deform) {
+					BKE_mask_calc_handle_point(mask, spline, &spline->points[i]);
+				}
 			}
 		}
 	}
@@ -1174,8 +1179,6 @@
 	MaskObject *maskobj;
 
 	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
-		MaskSpline *spline;
-		int i;
 
 		/* animation if available */
 		if (do_newframe) {
@@ -1210,7 +1213,15 @@
 			}
 		}
 		/* animation done... */
+	}
 
+	BKE_mask_calc_handles(mask);
+
+
+	for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
+		MaskSpline *spline;
+		int i;
+
 		for (spline = maskobj->splines.first; spline; spline = spline->next) {
 
 			BKE_mask_spline_ensure_deform(spline);
@@ -1227,11 +1238,9 @@
 
 					print_v2("", delta);
 
-					sub_v2_v2(point_deform->bezt.vec[0], delta);
-					sub_v2_v2(point_deform->bezt.vec[1], delta);
+					add_v2_v2(point_deform->bezt.vec[0], delta);
+					add_v2_v2(point_deform->bezt.vec[1], delta);
 					add_v2_v2(point_deform->bezt.vec[2], delta);
-
-					//point_deform->bezt.vec[1][1] += 1;
 				}
 				else {
 					*point_deform = *point;
@@ -1240,8 +1249,6 @@
 			}
 		}
 	}
-
-	BKE_mask_calc_handles(mask);
 }
 
 void BKE_mask_evaluate_all_masks(Main *bmain, float ctime, const int do_newframe)

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c	2012-05-29 10:41:00 UTC (rev 47167)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c	2012-05-29 11:00:02 UTC (rev 47168)
@@ -266,6 +266,9 @@
 		MaskSpline *spline;
 
 		for (spline = maskobj->splines.first; spline; spline = spline->next) {
+
+			BKE_mask_spline_ensure_deform(spline);
+
 			/* draw curve itself first... */
 			draw_spline_curve(maskobj, spline);
 
@@ -273,6 +276,17 @@
 
 			/* ...and then handles over the curve so they're nicely visible */
 			draw_spline_points(maskobj, spline);
+
+			/* show undeform for testing */
+			if (0) {
+				void *back = spline->points_deform;
+
+				spline->points_deform = NULL;
+				draw_spline_curve(maskobj, spline);
+				draw_spline_parents(maskobj, spline);
+				draw_spline_points(maskobj, spline);
+				spline->points_deform = back;
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list