[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47460] trunk/blender/source/blender/ blenkernel/intern/mask.c: change how the weight for feather points are calculated with masking, instead of using absolute weights, multiply by by the weights of the adjacent beziers.

Campbell Barton ideasman42 at gmail.com
Tue Jun 5 14:22:07 CEST 2012


Revision: 47460
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47460
Author:   campbellbarton
Date:     2012-06-05 12:22:02 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
change how the weight for feather points are calculated with masking, instead of using absolute weights, multiply by by the weights of the adjacent beziers.

without this - there was no way to animate the overall feather influence of the feather.

will update tools to account for this next.

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

Modified: trunk/blender/source/blender/blenkernel/intern/mask.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask.c	2012-06-05 12:09:24 UTC (rev 47459)
+++ trunk/blender/source/blender/blenkernel/intern/mask.c	2012-06-05 12:22:02 UTC (rev 47460)
@@ -777,6 +777,11 @@
 	normalize_v2(n);
 }
 
+static float mask_point_interp_weight(BezTriple *bezt, BezTriple *bezt_next, const float u)
+{
+	return (bezt->weight * (1.0f - u)) + (bezt_next->weight * u);
+}
+
 float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u)
 {
 	MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point);
@@ -801,7 +806,7 @@
 
 			if (i == 0) {
 				cur_u = 0.0f;
-				cur_w = bezt->weight;
+				cur_w = 1.0f; /* mask_point_interp_weight will scale it */
 			}
 			else {
 				cur_u = point->uw[i - 1].u;
@@ -810,7 +815,7 @@
 
 			if (i == point->tot_uw) {
 				next_u = 1.0f;
-				next_w = bezt_next->weight;
+				next_w = 1.0f; /* mask_point_interp_weight will scale it */
 			}
 			else {
 				next_u = point->uw[i].u;
@@ -824,6 +829,9 @@
 
 		fac = (u - cur_u) / (next_u - cur_u);
 
+		cur_w  *= mask_point_interp_weight(bezt, bezt_next, cur_u);
+		next_w *= mask_point_interp_weight(bezt, bezt_next, next_u);
+
 		if (spline->weight_interp == MASK_SPLINE_INTERP_EASE) {
 			return cur_w + (next_w - cur_w) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
 		}




More information about the Bf-blender-cvs mailing list