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 <campbell@blender.org>2022-04-04 06:11:44 +0300
committerCampbell Barton <campbell@blender.org>2022-04-04 06:11:44 +0300
commitdc5b1d6c75717a41c00042b667bc4a1a1609e588 (patch)
tree20a1265948358ee2caa6bfba46e7de47672c3795 /source/blender/editors/curve/editcurve_pen.c
parentff82bb5e3a27a7e16482ff8970a844fc63844d8e (diff)
Cleanup: pass selection threshold to curve picking
Remove the extended version of ED_curve_editnurb_select_pick, pass the size threshold directly to this function but as the distance in pixels instead of a multiplier for ED_view3d_select_dist_px. Using a multiplier is a less direct way to reference the threshold.
Diffstat (limited to 'source/blender/editors/curve/editcurve_pen.c')
-rw-r--r--source/blender/editors/curve/editcurve_pen.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index e3a2bd479bb..0524159fe54 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -844,8 +844,9 @@ static bool insert_point_to_segment(const ViewContext *vc, const wmEvent *event)
Curve *cu = vc->obedit->data;
CutData cd = init_cut_data(event);
float mval[2] = {UNPACK2(event->mval)};
+ const float threshold_dist_px = ED_view3d_select_dist_px() * SEL_DIST_FACTOR;
const bool near_spline = update_cut_data_for_all_nurbs(
- vc, BKE_curve_editNurbs_get(cu), mval, SEL_DIST_FACTOR * ED_view3d_select_dist_px(), &cd);
+ vc, BKE_curve_editNurbs_get(cu), mval, threshold_dist_px, &cd);
if (near_spline && !cd.nurb->hide) {
Nurb *nu = cd.nurb;
@@ -1554,6 +1555,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
ED_view3d_viewcontext_init(C, &vc, depsgraph);
Curve *cu = vc.obedit->data;
ListBase *nurbs = &cu->editnurb->nurbs;
+ const float threshold_dist_px = ED_view3d_select_dist_px() * SEL_DIST_FACTOR;
BezTriple *bezt = NULL;
BPoint *bp = NULL;
@@ -1655,7 +1657,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
else if (ELEM(event->type, LEFTMOUSE)) {
if (ELEM(event->val, KM_RELEASE, KM_DBL_CLICK)) {
if (delete_point && !cpd->new_point && !cpd->dragging) {
- if (ED_curve_editnurb_select_pick_ex(C, event->mval, SEL_DIST_FACTOR, &params)) {
+ if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, &params)) {
cpd->acted = delete_point_under_mouse(&vc, event);
}
}
@@ -1714,7 +1716,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
else if (select_point) {
- ED_curve_editnurb_select_pick_ex(C, event->mval, SEL_DIST_FACTOR, &params);
+ ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, &params);
}
}
@@ -1749,6 +1751,7 @@ static int curve_pen_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* Distance threshold for mouse clicks to affect the spline or its points */
const float mval_fl[2] = {UNPACK2(event->mval)};
+ const float threshold_dist_px = ED_view3d_select_dist_px() * SEL_DIST_FACTOR;
const bool extrude_point = RNA_boolean_get(op->ptr, "extrude_point");
const bool insert_point = RNA_boolean_get(op->ptr, "insert_point");
@@ -1804,7 +1807,7 @@ static int curve_pen_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
}
else if (!cpd->acted) {
- if (is_spline_nearby(&vc, op, event, SEL_DIST_FACTOR * ED_view3d_select_dist_px())) {
+ if (is_spline_nearby(&vc, op, event, threshold_dist_px)) {
cpd->spline_nearby = true;
/* If move segment is disabled, then insert point on key press and set