diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-04-05 19:47:10 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-04-05 19:47:10 +0300 |
commit | 7748dd4ec735535f53f61d6aa4a2f6b9db9abdc1 (patch) | |
tree | 65f854f448a2503bef50781212355b74fa616839 /source/blender/editors/curve | |
parent | 9e12a731db6f6647d5e6dfdaa32fc4d8117a523d (diff) | |
parent | b84255f590c07b129f726eadbfec72c73bfc2ee1 (diff) |
Merge remote-tracking branch 'origin/master' into temp-sculpt-colorstemp-sculpt-colors
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 755e538f415..9da9845116d 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1471,7 +1471,8 @@ static int curve_split_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - int ok = -1; + bool changed = false; + int count_failed = 0; uint objects_len; Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( @@ -1489,7 +1490,7 @@ static int curve_split_exec(bContext *C, wmOperator *op) adduplicateflagNurb(obedit, v3d, &newnurb, SELECT, true); if (BLI_listbase_is_empty(&newnurb)) { - ok = MAX2(ok, 0); + count_failed += 1; continue; } @@ -1504,14 +1505,16 @@ static int curve_split_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); } - ok = 1; + changed = true; WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); DEG_id_tag_update(obedit->data, 0); } MEM_freeN(objects); - if (ok == 0) { - BKE_report(op->reports, RPT_ERROR, "Cannot split current selection"); + if (changed == false) { + if (count_failed != 0) { + BKE_report(op->reports, RPT_ERROR, "Cannot split current selection"); + } return OPERATOR_CANCELLED; } return OPERATOR_FINISHED; @@ -4998,7 +5001,8 @@ static int spin_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ED_view3d_context_rv3d(C); float cent[3], axis[3], viewmat[4][4]; - int ok = -1; + bool changed = false; + int count_failed = 0; RNA_float_get_array(op->ptr, "center", cent); RNA_float_get_array(op->ptr, "axis", axis); @@ -5025,11 +5029,11 @@ static int spin_exec(bContext *C, wmOperator *op) mul_m4_v3(obedit->imat, cent); if (!ed_editnurb_spin(viewmat, v3d, obedit, axis, cent)) { - ok = MAX2(ok, 0); + count_failed += 1; continue; } - ok = 1; + changed = true; if (ED_curve_updateAnimPaths(bmain, cu)) { WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); } @@ -5039,8 +5043,11 @@ static int spin_exec(bContext *C, wmOperator *op) } MEM_freeN(objects); - if (ok == 0) { - BKE_report(op->reports, RPT_ERROR, "Cannot spin"); + if (changed == false) { + if (count_failed != 0) { + BKE_report(op->reports, RPT_ERROR, "Cannot spin"); + } + return OPERATOR_CANCELLED; } return OPERATOR_FINISHED; } @@ -5889,7 +5896,9 @@ static int duplicate_exec(bContext *C, wmOperator *op) { ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - int ok = -1; + + bool changed = false; + int count_failed = 0; uint objects_len = 0; Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( @@ -5906,19 +5915,21 @@ static int duplicate_exec(bContext *C, wmOperator *op) adduplicateflagNurb(obedit, v3d, &newnurb, SELECT, false); if (BLI_listbase_is_empty(&newnurb)) { - ok = MAX2(ok, 0); + count_failed += 1; continue; } - ok = 1; + changed = true; BLI_movelisttolist(object_editcurve_get(obedit), &newnurb); DEG_id_tag_update(&cu->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, &cu->id); } MEM_freeN(objects); - if (ok == 0) { - BKE_report(op->reports, RPT_ERROR, "Cannot duplicate current selection"); + if (changed == false) { + if (count_failed != 0) { + BKE_report(op->reports, RPT_ERROR, "Cannot duplicate current selection"); + } return OPERATOR_CANCELLED; } return OPERATOR_FINISHED; |