diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-30 22:14:26 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-30 22:22:55 +0300 |
commit | 47afabbb429d0fa67c858eb5031818122d37745c (patch) | |
tree | c5574ce0cb9b348257655dfa5673b44bd85fdd58 /source/blender/editors | |
parent | 456e3f00e007dbdeecb8a967ded9b7f4b2bc2969 (diff) |
Multi-Objects: CURVE_OT_select_nth
Based on D3407 by Daniel Griffin.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/curve/editcurve_select.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index 6792ff01347..f7ac16d2aad 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -1227,25 +1227,47 @@ static bool ed_curve_select_nth(Curve *cu, const struct CheckerIntervalParams *p static int select_nth_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - struct CheckerIntervalParams op_params; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *obact = CTX_data_edit_object(C); + View3D *v3d = CTX_wm_view3d(C); + bool changed = false; + struct CheckerIntervalParams op_params; WM_operator_properties_checker_interval_from_op(op, &op_params); - if (!ed_curve_select_nth(obedit->data, &op_params)) { - if (obedit->type == OB_SURF) { - BKE_report(op->reports, RPT_ERROR, "Surface has not got active point"); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + Curve *cu = obedit->data; + + if (!ED_curve_select_check(v3d, cu->editnurb)) { + continue; } - else { - BKE_report(op->reports, RPT_ERROR, "Curve has not got active point"); + + if (ed_curve_select_nth(obedit->data, &op_params) == true) { + changed = true; + DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); } + } + MEM_freeN(objects); + if (!changed) { + if (obact->type == OB_SURF) { + BKE_report(op->reports, RPT_ERROR, + (objects_len == 1 ? + "Surface has no active point" : + "Surfaces have no active point")); + } + else { + BKE_report(op->reports, RPT_ERROR, + (objects_len == 1 ? + "Curve has no active point" : + "Curves have no active point")); + } return OPERATOR_CANCELLED; } - - DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE); - WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); - return OPERATOR_FINISHED; } |