diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-26 03:11:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-26 03:35:32 +0400 |
commit | eaf815f14a928f7d99db93013c9ad8daae539094 (patch) | |
tree | 39dbe47367aa37c83ef0f9455e4ea8f707e1acca /source/blender/editors/curve | |
parent | f574b1ca3cda82b2cffa992bd4288c44e99cc643 (diff) |
Fix for curve having invalid active vertex after setting type
also allow passing NULL vertex to BKE_curve_nurb_vert_active_set
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 2fdc9ff846b..f5cfc289ab9 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3916,6 +3916,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) ListBase *editnurb = object_editcurve_get(obedit); Nurb *nu; bool changed = false; + bool changed_size = false; const bool use_handles = RNA_boolean_get(op->ptr, "use_handles"); const int type = RNA_enum_get(op->ptr, "type"); @@ -3926,10 +3927,16 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) for (nu = editnurb->first; nu; nu = nu->next) { if (isNurbsel(nu)) { - if (BKE_nurb_type_convert(nu, type, use_handles) == false) - BKE_report(op->reports, RPT_ERROR, "No conversion possible"); - else + const int pntsu_prev = nu->pntsu; + if (BKE_nurb_type_convert(nu, type, use_handles)) { changed = true; + if (pntsu_prev != nu->pntsu) { + changed_size = true; + } + } + else { + BKE_report(op->reports, RPT_ERROR, "No conversion possible"); + } } } @@ -3940,6 +3947,11 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); + if (changed_size) { + Curve *cu = obedit->data; + cu->actvert = CU_ACT_NONE; + } + return OPERATOR_FINISHED; } else { |