diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-13 19:59:03 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-13 19:59:03 +0400 |
commit | bcee57e74e587260f2a7050b3b8a1894fe592466 (patch) | |
tree | 96a48a5c9b1175e69ef1b19eae7daa479d72e765 /source/blender/editors/mask/mask_add.c | |
parent | 99a386da9ecc2cd3bdf2f1149e1a7de578190c56 (diff) |
Roto: Improve spline sliding vs. curvature detection
If the mouse is closer to the spline than to it's center do a
spline curvature correction operator instead.
Diffstat (limited to 'source/blender/editors/mask/mask_add.c')
-rw-r--r-- | source/blender/editors/mask/mask_add.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index b816103de13..cd6e93771c0 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -62,7 +62,8 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, MaskSplinePoint **point_r, float *u_r, float tangent[2], const bool use_deform, - const bool use_project) + const bool use_project, + float *score_r) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); @@ -171,6 +172,10 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, *u_r = u; } + if (score_r) { + *score_r = dist; + } + return true; } @@ -339,7 +344,7 @@ static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2 float tangent[2]; float u; - if (ED_mask_find_nearest_diff_point(C, mask, co, threshold, false, &masklay, &spline, &point, &u, tangent, true, true)) { + if (ED_mask_find_nearest_diff_point(C, mask, co, threshold, false, &masklay, &spline, &point, &u, tangent, true, true, NULL)) { MaskSplinePoint *new_point; int point_index = point - spline->points; @@ -624,7 +629,7 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op) if (point) return OPERATOR_FINISHED; - if (ED_mask_find_nearest_diff_point(C, mask, co, threshold, true, &masklay, &spline, &point, &u, NULL, true, true)) { + if (ED_mask_find_nearest_diff_point(C, mask, co, threshold, true, &masklay, &spline, &point, &u, NULL, true, true, NULL)) { Scene *scene = CTX_data_scene(C); float w = BKE_mask_point_weight(spline, point, u); float weight_scalar = BKE_mask_point_weight_scalar(spline, point, u); |