diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-27 01:54:11 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-27 02:01:19 +0300 |
commit | 6479e800bc21e06c5afe002f5b9f4efb80e6db53 (patch) | |
tree | edad7b3791b3e4d870315e57d14cde5f12a23344 /source/blender/editors/curve/editcurve_select.c | |
parent | 7cbbc65faa68628fcd1c9a3c7776d04374aed383 (diff) |
Multi-Objects: Curve - select pick, linked and short path
I'm following mesh editing to decide when to switch active object, or
deselect the other objects. I hope we can keep this all consistent in
the end.
Diffstat (limited to 'source/blender/editors/curve/editcurve_select.c')
-rw-r--r-- | source/blender/editors/curve/editcurve_select.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index d7ceb86c373..1a4785f16f7 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -48,6 +48,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_object.h" #include "ED_screen.h" #include "ED_select_utils.h" #include "ED_types.h" @@ -583,18 +584,19 @@ void CURVE_OT_select_linked(wmOperatorType *ot) static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - Object *obedit = CTX_data_edit_object(C); ViewContext vc; Nurb *nu; BezTriple *bezt; BPoint *bp; int a; const bool select = !RNA_boolean_get(op->ptr, "deselect"); + Base *basact = NULL; view3d_operator_needs_opengl(C); ED_view3d_viewcontext_init(C, &vc); + copy_v2_v2_int(vc.mval, event->mval); - if (!ED_curve_pick_vert(&vc, 1, event->mval, &nu, &bezt, &bp, NULL)) { + if (!ED_curve_pick_vert(&vc, 1, &nu, &bezt, &bp, NULL, &basact)) { return OPERATOR_CANCELLED; } @@ -615,8 +617,11 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent } } + Object *obedit = basact->object; + DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); + if (!select) { BKE_curve_nurb_vert_active_validate(obedit->data); } @@ -1717,26 +1722,29 @@ static void curve_select_shortest_path_surf(Nurb *nu, int vert_src, int vert_dst static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - Object *obedit = CTX_data_edit_object(C); - Curve *cu = obedit->data; - Nurb *nu_src = BKE_curve_nurb_active_get(cu); - int vert_src = cu->actvert; - ViewContext vc; Nurb *nu_dst; BezTriple *bezt_dst; BPoint *bp_dst; int vert_dst; void *vert_dst_p; + Base *basact = NULL; - if (vert_src == CU_ACT_NONE) { + view3d_operator_needs_opengl(C); + ED_view3d_viewcontext_init(C, &vc); + copy_v2_v2_int(vc.mval, event->mval); + + if (!ED_curve_pick_vert(&vc, 1, &nu_dst, &bezt_dst, &bp_dst, NULL, &basact)) { return OPERATOR_PASS_THROUGH; } - view3d_operator_needs_opengl(C); - ED_view3d_viewcontext_init(C, &vc); + ED_view3d_viewcontext_init_object(&vc, basact->object); + Object *obedit = basact->object; + Curve *cu = obedit->data; + Nurb *nu_src = BKE_curve_nurb_active_get(cu); + int vert_src = cu->actvert; - if (!ED_curve_pick_vert(&vc, 1, event->mval, &nu_dst, &bezt_dst, &bp_dst, NULL)) { + if (vert_src == CU_ACT_NONE) { return OPERATOR_PASS_THROUGH; } @@ -1760,6 +1768,10 @@ static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE BKE_curve_nurb_vert_active_set(cu, nu_dst, vert_dst_p); + if (vc.view_layer->basact != basact) { + ED_object_base_activate(C, basact); + } + DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); return OPERATOR_FINISHED; |