[Bf-blender-cvs] [22e5dfde3ad] soc-2021-curves: undo point select threshold
dilithjay
noreply at git.blender.org
Sun Dec 5 16:48:42 CET 2021
Commit: 22e5dfde3ad6f4d76000a0b037de0249e6d990db
Author: dilithjay
Date: Sun Dec 5 21:18:27 2021 +0530
Branches: soc-2021-curves
https://developer.blender.org/rB22e5dfde3ad6f4d76000a0b037de0249e6d990db
undo point select threshold
===================================================================
M source/blender/editors/curve/editcurve_pen.c
===================================================================
diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index ad805fbe45a..abd5f9bdee8 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -332,7 +332,7 @@ static void get_closest_vertex_to_point_in_nurbs(ListBase *nurbs,
}
}
- const float threshold_distance = ED_view3d_select_dist_px() * 0.4;
+ const float threshold_distance = ED_view3d_select_dist_px();
if (min_distance_bezt < threshold_distance || min_distance_bp < threshold_distance) {
if (min_distance_bp < min_distance_bezt) {
*r_bp = closest_bp;
@@ -747,7 +747,7 @@ static bool is_spline_nearby(ViewContext *vc, wmOperator *op, const wmEvent *eve
update_data_for_all_nurbs(nurbs, vc, &data);
- const float threshold_distance = ED_view3d_select_dist_px() * 0.4f;
+ const float threshold_distance = ED_view3d_select_dist_px() * 0.3f;
if (data.nurb && !data.nurb->bp && data.min_dist < threshold_distance) {
MoveSegmentData *seg_data;
op->customdata = seg_data = MEM_callocN(sizeof(MoveSegmentData), __func__);
@@ -827,34 +827,6 @@ static void move_segment(MoveSegmentData *seg_data, const wmEvent *event, ViewCo
}
}
-static bool check_selected_threshold(BezTriple *prev_bezt,
- BPoint *prev_bp,
- ViewContext *vc,
- EditNurb *editnurb,
- const float mval[2])
-{
- Nurb *nu = NULL;
- BezTriple *bezt = NULL;
- BPoint *bp = NULL;
- ED_curve_nurb_vert_selected_find(vc->obedit->data, vc->v3d, &nu, &bezt, &bp);
- float screen_co[2];
-
- if (bezt)
- ED_view3d_project_float_object(
- vc->region, bezt->vec[1], screen_co, V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN);
- if (len_manhattan_v2v2(screen_co, mval) >= ED_view3d_select_dist_px() * 0.4f) {
- ED_curve_deselect_all(editnurb);
- if (prev_bezt) {
- select_beztriple(prev_bezt, SELECT, SELECT, HIDDEN);
- }
- else if (prev_bp) {
- select_bpoint(prev_bp, SELECT, SELECT, HIDDEN);
- }
- return false;
- }
- return true;
-}
-
/* Close the spline if endpoints are selected consecutively. Return true if cycle was created. */
static bool make_cyclic_if_endpoints(
Nurb *sel_nu, BezTriple *sel_bezt, BPoint *sel_bp, ViewContext *vc, bContext *C)
@@ -996,11 +968,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Get currently selected point if any. Used for making spline cyclic. */
ED_curve_nurb_vert_selected_find(cu, vc.v3d, &nu, &bezt, &bp);
- bool found_point = ED_curve_editnurb_select_pick(C, event->mval, false, false, false);
- if (found_point) {
- const float mval[2] = {(float)event->mval[0], (float)event->mval[1]};
- found_point = check_selected_threshold(bezt, bp, &vc, cu->editnurb, mval);
- }
+ const bool found_point = ED_curve_editnurb_select_pick(C, event->mval, false, false, false);
RNA_boolean_set(op->ptr, "new", !found_point);
if (found_point) {
More information about the Bf-blender-cvs
mailing list