Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve.c
| Context not available. | |||||
| static int curve_split_exec(bContext *C, wmOperator *op) | static int curve_split_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | ViewLayer * view_layer = CTX_data_view_layer(C); | ||||
| ListBase *editnurb = object_editcurve_get(obedit); | uint objects_len = 0; | ||||
| ListBase newnurb = {NULL, NULL}; | 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; | |||||
| adduplicateflagNurb(obedit, &newnurb, SELECT, true); | if (!ED_curve_select_check(cu, cu->editnurb)) { | ||||
| continue; | |||||
| } | |||||
| if (BLI_listbase_is_empty(&newnurb) == false) { | ListBase *editnurb = object_editcurve_get(obedit); | ||||
| Curve *cu = obedit->data; | ListBase newnurb = { NULL, NULL }; | ||||
| const int len_orig = BLI_listbase_count(editnurb); | |||||
| curve_delete_segments(obedit, true); | adduplicateflagNurb(obedit, &newnurb, SELECT, true); | ||||
| cu->actnu -= len_orig - BLI_listbase_count(editnurb); | |||||
| BLI_movelisttolist(editnurb, &newnurb); | |||||
| if (ED_curve_updateAnimPaths(obedit->data)) | if (BLI_listbase_is_empty(&newnurb) == false) { | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); | Curve *cu = obedit->data; | ||||
| const int len_orig = BLI_listbase_count(editnurb); | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); | curve_delete_segments(obedit, true); | ||||
| DEG_id_tag_update(obedit->data, 0); | cu->actnu -= len_orig - BLI_listbase_count(editnurb); | ||||
| } | BLI_movelisttolist(editnurb, &newnurb); | ||||
| else { | |||||
| BKE_report(op->reports, RPT_ERROR, "Cannot split current selection"); | if (ED_curve_updateAnimPaths(obedit->data)) | ||||
| return OPERATOR_CANCELLED; | 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); | |||||
| } | |||||
| else { | |||||
| continue; | |||||
| } | |||||
| } | } | ||||
| MEM_freeN(objects); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||