Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-10-31 00:54:34 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-10-31 00:59:43 +0300
commite9980e5a75e160bb038456b8cb09804f19bea00c (patch)
treedec662d0334885f55c7f6f2bb2249760966b9c94 /source/blender/editors/curve
parent46bf079b7f4c28a69861194b1783ae286ed66790 (diff)
Multi-Objects: CURVE_OT_split
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4ba765efa46..89d1575c650 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1372,32 +1372,50 @@ void CURVE_OT_separate(wmOperatorType *ot)
static int curve_split_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 *editnurb = object_editcurve_get(obedit);
- ListBase newnurb = {NULL, NULL};
-
- adduplicateflagNurb(obedit, v3d, &newnurb, SELECT, true);
+ int ok = -1;
- if (BLI_listbase_is_empty(&newnurb) == false) {
+ 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;
+
+ if (!ED_curve_select_check(v3d, cu->editnurb)) {
+ continue;
+ }
+
+ ListBase newnurb = {NULL, NULL};
+
+ adduplicateflagNurb(obedit, v3d, &newnurb, SELECT, true);
+
+ if (BLI_listbase_is_empty(&newnurb)) {
+ ok = MAX2(ok, 0);
+ continue;
+ }
+
+ ListBase *editnurb = object_editcurve_get(obedit);
const int len_orig = BLI_listbase_count(editnurb);
curve_delete_segments(obedit, v3d, true);
cu->actnu -= len_orig - BLI_listbase_count(editnurb);
BLI_movelisttolist(editnurb, &newnurb);
- if (ED_curve_updateAnimPaths(obedit->data))
+ if (ED_curve_updateAnimPaths(obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
+ ok = 1;
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
DEG_id_tag_update(obedit->data, 0);
}
- else {
+ MEM_freeN(objects);
+
+ if (ok == 0) {
BKE_report(op->reports, RPT_ERROR, "Cannot split current selection");
return OPERATOR_CANCELLED;
}
-
return OPERATOR_FINISHED;
}