diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-31 00:31:27 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-31 00:31:27 +0300 |
commit | b9d58887282470244b906bf5a582390169129f3d (patch) | |
tree | 026f8ef95f95967d58eb4f2165119349dd4ee7b0 /source | |
parent | 993f4d48279118c8355a7e1d802effddbe240d80 (diff) |
Multi-Objects: CURVE_OT_duplicate
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index bda0d67b2a4..e7478b3253d 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5375,22 +5375,39 @@ void CURVE_OT_cyclic_toggle(wmOperatorType *ot) static int duplicate_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); + ViewLayer * view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - ListBase newnurb = {NULL, NULL}; + int ok = -1; - adduplicateflagNurb(obedit, v3d, &newnurb, SELECT, false); + 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 (BLI_listbase_is_empty(&newnurb) == false) { + if (!ED_curve_select_check(v3d, cu->editnurb)) { + ok = MAX2(ok, 0); + continue; + } + + ListBase newnurb = {NULL, NULL}; + adduplicateflagNurb(obedit, v3d, &newnurb, SELECT, false); + + if (BLI_listbase_is_empty(&newnurb)) { + continue; + } + + ok = 1; BLI_movelisttolist(object_editcurve_get(obedit), &newnurb); DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); } - else { + MEM_freeN(objects); + + if (ok == 0) { BKE_report(op->reports, RPT_ERROR, "Cannot duplicate current selection"); return OPERATOR_CANCELLED; } - return OPERATOR_FINISHED; } |