diff options
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 15 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 39 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve_pen.c | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_curve.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 13 |
5 files changed, 61 insertions, 12 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 91871246cae..1cdb2c8e679 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -4720,6 +4720,10 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ # NOTE: `exclude_mod` is needed since we don't want this tool to exclude Control-RMB actions when this is used # as a tool key-map with RMB-select and `use_fallback_tool_rmb` is enabled. See T92467. + props_vert_without_handles = () + if select_passthrough: + props_vert_without_handles = ("vert_without_handles",) + # See: `use_tweak_select_passthrough` doc-string. if select_passthrough and (value in {'CLICK', 'RELEASE'}): select_passthrough = False @@ -4729,9 +4733,9 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ {"type": type, "value": value, **{m: True for m in mods}}, {"properties": [(c, True) for c in props]}, ) for props, mods in ( - ((("deselect_all", "select_passthrough") if select_passthrough else - ("deselect_all",)) if not legacy else (), ()), - (("toggle",), ("shift",)), + ((("deselect_all", "select_passthrough", *props_vert_without_handles) if select_passthrough else + ("deselect_all", *props_vert_without_handles)) if not legacy else (), ()), + (("toggle", *props_vert_without_handles), ("shift",)), (("center", "object"), ("ctrl",)), (("enumerate",), ("alt",)), (("toggle", "center"), ("shift", "ctrl")), @@ -4746,7 +4750,10 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ items.append(( "view3d.select", {"type": type, "value": 'CLICK'}, - {"properties": [("deselect_all", True)]}, + {"properties": [ + (c, True) + for c in ("deselect_all", *props_vert_without_handles) + ]}, )) return items diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9da9845116d..dc49a5ed531 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4729,6 +4729,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot) bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], const int dist_px, + const bool vert_without_handles, const struct SelectPick_Params *params) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -4744,6 +4745,9 @@ bool ED_curve_editnurb_select_pick(bContext *C, ED_view3d_viewcontext_init(C, &vc, depsgraph); copy_v2_v2_int(vc.mval, mval); + const bool use_handle_select = vert_without_handles && + (vc.v3d->overlay.handle_display != CURVE_HANDLE_NONE); + bool found = ED_curve_pick_vert_ex(&vc, 1, dist_px, &nu, &bezt, &bp, &hand, &basact); if (params->sel_op == SEL_OP_SET) { @@ -4779,7 +4783,12 @@ bool ED_curve_editnurb_select_pick(bContext *C, case SEL_OP_ADD: { if (bezt) { if (hand == 1) { - select_beztriple(bezt, SELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 |= SELECT; + } + else { + select_beztriple(bezt, SELECT, SELECT, HIDDEN); + } } else { if (hand == 0) { @@ -4800,7 +4809,12 @@ bool ED_curve_editnurb_select_pick(bContext *C, case SEL_OP_SUB: { if (bezt) { if (hand == 1) { - select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 &= ~SELECT; + } + else { + select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + } if (bezt == vert) { cu->actvert = CU_ACT_NONE; } @@ -4824,13 +4838,23 @@ bool ED_curve_editnurb_select_pick(bContext *C, if (bezt) { if (hand == 1) { if (bezt->f2 & SELECT) { - select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 &= ~SELECT; + } + else { + select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + } if (bezt == vert) { cu->actvert = CU_ACT_NONE; } } else { - select_beztriple(bezt, SELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 |= SELECT; + } + else { + select_beztriple(bezt, SELECT, SELECT, HIDDEN); + } BKE_curve_nurb_vert_active_set(cu, nu, bezt); } } @@ -4861,7 +4885,12 @@ bool ED_curve_editnurb_select_pick(bContext *C, if (bezt) { if (hand == 1) { - select_beztriple(bezt, SELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 |= SELECT; + } + else { + select_beztriple(bezt, SELECT, SELECT, HIDDEN); + } } else { if (hand == 0) { diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index fca850076ae..a98b165e99d 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -1655,7 +1655,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(C, event->mval, threshold_dist_px, ¶ms)) { + if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, false, ¶ms)) { cpd->acted = delete_point_under_mouse(&vc, event); } } @@ -1714,7 +1714,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (select_point) { - ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, ¶ms); + ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, false, ¶ms); } } diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 9f4833bf1d7..061b783797d 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -49,10 +49,12 @@ void ED_curve_editnurb_free(struct Object *obedit); /** * \param dist_px: Maximum distance to pick (in pixels). + * \param vert_without_handles: When true, selecting the knot doesn't select the handles. */ bool ED_curve_editnurb_select_pick(struct bContext *C, const int mval[2], int dist_px, + bool vert_without_handles, const struct SelectPick_Params *params); struct Nurb *ED_curve_add_nurbs_primitive( diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index efe89621e7b..fc817b43a8b 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2878,6 +2878,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op) struct SelectPick_Params params = {0}; ED_select_pick_params_from_operator(op->ptr, ¶ms); + const bool vert_without_handles = RNA_boolean_get(op->ptr, "vert_without_handles"); bool center = RNA_boolean_get(op->ptr, "center"); bool enumerate = RNA_boolean_get(op->ptr, "enumerate"); /* Only force object select for edit-mode to support vertex parenting, @@ -2932,7 +2933,8 @@ static int view3d_select_exec(bContext *C, wmOperator *op) changed = ED_lattice_select_pick(C, mval, ¶ms); } else if (ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) { - changed = ED_curve_editnurb_select_pick(C, mval, ED_view3d_select_dist_px(), ¶ms); + changed = ED_curve_editnurb_select_pick( + C, mval, ED_view3d_select_dist_px(), vert_without_handles, ¶ms); } else if (obedit->type == OB_MBALL) { changed = ED_mball_select_pick(C, mval, ¶ms); @@ -3009,6 +3011,15 @@ void VIEW3D_OT_select(wmOperatorType *ot) prop = RNA_def_boolean(ot->srna, "object", 0, "Object", "Use object selection (edit mode only)"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + /* Needed for select-through to usefully drag handles, see: T98254. + * NOTE: this option may be removed and become default behavior, see design task: T98552. */ + prop = RNA_def_boolean(ot->srna, + "vert_without_handles", + 0, + "Control Point Without Handles", + "Only select the curve control point, not it's handles"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_int_vector(ot->srna, "location", 2, |