diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-23 08:41:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-23 08:41:58 +0300 |
commit | 17aef80207bcff8bfb58e4da890b7f1310318a4c (patch) | |
tree | e711288626b9e46ed37f0484d805d383dd47aa1f /source/blender/editors/curve/editcurve.c | |
parent | 647232f7f16c9fa623a3cde92e4dfa9073c141cc (diff) |
Multi-Object-Mode: EditCurve Subdivide
D3382 by @dgriffin91
Diffstat (limited to 'source/blender/editors/curve/editcurve.c')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index fc6520a33f2..eb180c6bde9 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3371,16 +3371,29 @@ static void subdividenurb(Object *obedit, int number_cuts) static int subdivide_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - int number_cuts = RNA_int_get(op->ptr, "number_cuts"); + const int number_cuts = RNA_int_get(op->ptr, "number_cuts"); - subdividenurb(obedit, number_cuts); + ViewLayer *view_layer = CTX_data_view_layer(C); - if (ED_curve_updateAnimPaths(obedit->data)) - WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); + 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; - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DEG_id_tag_update(obedit->data, 0); + if (!ED_curve_select_check(cu, cu->editnurb)) { + continue; + } + + subdividenurb(obedit, number_cuts); + + if (ED_curve_updateAnimPaths(cu)) + WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); + + WM_event_add_notifier(C, NC_GEOM | ND_DATA, cu); + DEG_id_tag_update(obedit->data, 0); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |