Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-05 16:51:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-05 16:51:11 +0400
commitfe58f668a122fde73b14d20ffec6cd3f75034eea (patch)
tree967e68ae19645e527a88d28022010110f415eb73 /source/blender/blenkernel
parentf72c8565bf86cd19396a12d4cdf65aaeb35efb74 (diff)
mask point slide now accounts for scaled bezier weights,
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_mask.h1
-rw-r--r--source/blender/blenkernel/intern/mask.c23
2 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index f426d96cd5e..3ca892604c5 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -98,6 +98,7 @@ float *BKE_mask_point_segment_feather_diff_with_resolution(struct MaskSpline *sp
void BKE_mask_point_segment_co(struct MaskSpline *spline, struct MaskSplinePoint *point, float u, float co[2]);
void BKE_mask_point_normal(struct MaskSpline *spline, struct MaskSplinePoint *point,
float u, float n[2]);
+float BKE_mask_point_weight_scalar(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, float u);
struct MaskSplinePointUW *BKE_mask_point_sort_uw(struct MaskSplinePoint *point, struct MaskSplinePointUW *uw);
void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w);
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 4104d5f274b..102ec454aaa 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -782,7 +782,28 @@ static float mask_point_interp_weight(BezTriple *bezt, BezTriple *bezt_next, con
return (bezt->weight * (1.0f - u)) + (bezt_next->weight * u);
}
-float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u)
+float BKE_mask_point_weight_scalar(MaskSpline *spline, MaskSplinePoint *point, const float u)
+{
+ MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point);
+ BezTriple *bezt = &point->bezt, *bezt_next;
+
+ bezt_next = mask_spline_point_next_bezt(spline, points_array, point);
+
+ if (!bezt_next) {
+ return bezt->weight;
+ }
+ else if (u <= 0.0) {
+ return bezt->weight;
+ }
+ else if (u >= 1.0f) {
+ return bezt_next->weight;
+ }
+ else {
+ return mask_point_interp_weight(bezt, bezt_next, u);
+ }
+}
+
+float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, const float u)
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point);
BezTriple *bezt = &point->bezt, *bezt_next;