[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47557] trunk/blender/source/blender: improvement to handle recalculation, only do this on auto-handles when they are in a spline.

Campbell Barton ideasman42 at gmail.com
Thu Jun 7 09:29:08 CEST 2012


Revision: 47557
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47557
Author:   campbellbarton
Date:     2012-06-07 07:28:55 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
improvement to handle recalculation, only do this on auto-handles when they are in a spline.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/mask.c
    trunk/blender/source/blender/makesdna/DNA_mask_types.h

Modified: trunk/blender/source/blender/blenkernel/intern/mask.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask.c	2012-06-07 06:35:37 UTC (rev 47556)
+++ trunk/blender/source/blender/blenkernel/intern/mask.c	2012-06-07 07:28:55 UTC (rev 47557)
@@ -1399,14 +1399,6 @@
 	}
 }
 
-void BKE_mask_calc_handles_deform(Mask *mask)
-{
-	MaskLayer *masklay;
-	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
-		BKE_mask_layer_calc_handles_deform(masklay);
-	}
-}
-
 void BKE_mask_update_deform(Mask *mask)
 {
 	MaskLayer *masklay;
@@ -1516,9 +1508,10 @@
 
 	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
 		MaskSpline *spline;
-		int i;
 
 		for (spline = masklay->splines.first; spline; spline = spline->next) {
+			int i;
+			int has_auto = FALSE;
 
 			BKE_mask_spline_ensure_deform(spline);
 
@@ -1537,12 +1530,24 @@
 					add_v2_v2(point_deform->bezt.vec[1], delta);
 					add_v2_v2(point_deform->bezt.vec[2], delta);
 				}
+
+				if (point->bezt.h1 == HD_AUTO) {
+					has_auto = TRUE;
+				}
 			}
+
+			/* if the spline has auto handles, these need to be recalculated after deformation */
+			if (has_auto) {
+				for (i = 0; i < spline->tot_point; i++) {
+					MaskSplinePoint *point_deform = &spline->points_deform[i];
+					if (point_deform->bezt.h1 == HD_AUTO) {
+						BKE_mask_calc_handle_point(spline, point_deform);
+					}
+				}
+			}
+			/* end extra calc handles loop */
 		}
 	}
-
-	/* TODO, move into loop above and only run if there are auto-handles */
-	BKE_mask_calc_handles_deform(mask);
 }
 
 /* the purpose of this function is to ensure spline->points_deform is never out of date.

Modified: trunk/blender/source/blender/makesdna/DNA_mask_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_mask_types.h	2012-06-07 06:35:37 UTC (rev 47556)
+++ trunk/blender/source/blender/makesdna/DNA_mask_types.h	2012-06-07 07:28:55 UTC (rev 47557)
@@ -43,9 +43,9 @@
 typedef struct Mask {
 	ID id;
 	struct AnimData *adt;
-	ListBase masklayers;   /* mask layers */
-	int masklay_act;     /* index of active mask layer (-1 == None) */
-	int masklay_tot;     /* total number of mask layers */
+	ListBase masklayers;  /* mask layers */
+	int masklay_act;      /* index of active mask layer (-1 == None) */
+	int masklay_tot;      /* total number of mask layers */
 } Mask;
 
 typedef struct MaskParent {
@@ -166,5 +166,4 @@
 	MASK_BLENDFLAG_INVERT = (1 << 0)
 };
 
-
 #endif // __DNA_MASK_TYPES_H__




More information about the Bf-blender-cvs mailing list