diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-30 23:53:52 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-30 23:53:52 +0300 |
commit | 993f4d48279118c8355a7e1d802effddbe240d80 (patch) | |
tree | 27f8649d9c7256b427c35e2db380e3a942c4341a | |
parent | 258ad21cf2b3f388ac4316f3d7867eae3e93c36b (diff) |
Multi-Objects: CURVE_OT_extrude
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 3c2c371ab41..bda0d67b2a4 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5174,42 +5174,52 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *obedit = CTX_data_edit_object(C); + ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - Curve *cu = obedit->data; - EditNurb *editnurb = cu->editnurb; - bool changed = false; - bool as_curve = false; - /* first test: curve? */ - if (obedit->type != OB_CURVE) { - Nurb *nu; - for (nu = editnurb->nurbs.first; nu; nu = nu->next) { - if ((nu->pntsv == 1) && - (ED_curve_nurb_select_count(v3d, nu) == 1)) - { - as_curve = true; - break; - } + uint objects_len; + 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; + EditNurb *editnurb = cu->editnurb; + bool changed = false; + bool as_curve = false; + + if (!ED_curve_select_check(v3d, cu->editnurb)) { + continue; } - } - if (obedit->type == OB_CURVE || as_curve) { - changed = ed_editcurve_extrude(cu, editnurb, v3d); - } - else { - changed = ed_editnurb_extrude_flag(editnurb, SELECT); - } + /* First test: curve? */ + if (obedit->type != OB_CURVE) { + Nurb *nu; + for (nu = editnurb->nurbs.first; nu; nu = nu->next) { + if ((nu->pntsv == 1) && + (ED_curve_nurb_select_count(v3d, nu) == 1)) + { + as_curve = true; + break; + } + } + } - if (changed) { - if (ED_curve_updateAnimPaths(obedit->data)) { - WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); + if (obedit->type == OB_CURVE || as_curve) { + changed = ed_editcurve_extrude(cu, editnurb, v3d); + } + else { + changed = ed_editnurb_extrude_flag(editnurb, SELECT); } - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DEG_id_tag_update(obedit->data, 0); - } + if (changed) { + if (ED_curve_updateAnimPaths(obedit->data)) { + WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); + } + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); + DEG_id_tag_update(obedit->data, 0); + } + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |