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-06-02 06:30:44 +0300
committerCampbell Barton <campbell@blender.org>2022-06-02 06:55:06 +0300
commit0f73a27b76d789df04158905cba65dec0881bf12 (patch)
treecd5d83d8f632a2702947667d78c3ae20eb3b5e09 /source/blender
parentef3f33dfd3ed91b122ada7714fd1636360d12cde (diff)
Fix T98552: Experimental Tweak Select: Curve handle tweak is difficult
When this preference is enabled, use selection behavior matching the graph editor. We may want to make this default (see T98552).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/curve/editcurve.c39
-rw-r--r--source/blender/editors/curve/editcurve_pen.c4
-rw-r--r--source/blender/editors/include/ED_curve.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c13
4 files changed, 50 insertions, 8 deletions
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, &params)) {
+ if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, false, &params)) {
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, &params);
+ ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, false, &params);
}
}
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, &params);
+ 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, &params);
}
else if (ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) {
- changed = ED_curve_editnurb_select_pick(C, mval, ED_view3d_select_dist_px(), &params);
+ changed = ED_curve_editnurb_select_pick(
+ C, mval, ED_view3d_select_dist_px(), vert_without_handles, &params);
}
else if (obedit->type == OB_MBALL) {
changed = ED_mball_select_pick(C, mval, &params);
@@ -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,