diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-05 16:22:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-05 16:22:02 +0400 |
commit | f72c8565bf86cd19396a12d4cdf65aaeb35efb74 (patch) | |
tree | 9154b7ba1fe5351a1bbd2eb11e9d4dbe91d82504 /source/blender | |
parent | 49cc9c7502dcbdc60b4d0e7df7fe3e304e622010 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 26e0f14e08b..4104d5f274b 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -777,6 +777,11 @@ void BKE_mask_point_normal(MaskSpline *spline, MaskSplinePoint *point, float u, 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 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u) 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 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u) 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 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u) 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); } |