diff options
author | Kevin Mackay <mackay.ka@gmail.com> | 2013-11-06 03:37:09 +0400 |
---|---|---|
committer | Kevin Mackay <mackay.ka@gmail.com> | 2013-11-06 03:37:09 +0400 |
commit | 299812f28d32950a9bbf4612a3a5fef46054e7fb (patch) | |
tree | 1be704188a2132b3d2ea19360d185697e6494e2e /source/blender/editors/curve/editcurve.c | |
parent | 7874447e4a75d77eddacb0b0186ea1e9f2c76596 (diff) |
Made active point and active spline behaviour more predictable on curves/surfaces:
* deselect all no longer leaves an active point
* the most recently added spline becomes the active one
* on successful duplicate/delete the active point and active spline are reset
Diffstat (limited to 'source/blender/editors/curve/editcurve.c')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index bd91740521d..f576440fe92 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1279,6 +1279,8 @@ void CU_deselect_all(Object *obedit) if (editnurb) { Nurb *nu; int a; + ((Curve *)obedit->data)->lastsel = NULL; + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->bezt) { BezTriple *bezt; @@ -1902,7 +1904,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, int a, b, c, starta, enda, diffa, cyclicu, cyclicv, newu, newv; char *usel; - cu->lastsel = NULL; while (nu) { cyclicu = cyclicv = 0; if (nu->type == CU_BEZIER) { @@ -1927,7 +1928,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, newnu = BKE_nurb_copy(nu, newu, 1); BLI_addtail(newnurb, newnu); - set_actNurb(obedit, newnu); memcpy(newnu->bezt, &nu->bezt[starta], diffa * sizeof(BezTriple)); if (newu != diffa) { memcpy(&newnu->bezt[diffa], nu->bezt, cyclicu * sizeof(BezTriple)); @@ -1976,7 +1976,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, newnu = BKE_nurb_copy(nu, newu, 1); BLI_addtail(newnurb, newnu); - set_actNurb(obedit, newnu); memcpy(newnu->bp, &nu->bp[starta], diffa * sizeof(BPoint)); if (newu != diffa) { memcpy(&newnu->bp[diffa], nu->bp, cyclicu * sizeof(BPoint)); @@ -1995,8 +1994,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, if (cyclicu != 0) { newnu = BKE_nurb_copy(nu, cyclicu, 1); BLI_addtail(newnurb, newnu); - set_actNurb(obedit, newnu); - memcpy(newnu->bp, nu->bp, cyclicu * sizeof(BPoint)); newnu->flagu &= ~CU_NURB_CYCLIC; @@ -2093,7 +2090,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, memcpy(&newnu->bp[b * newu], &nu->bp[b * nu->pntsu + a], newu * sizeof(BPoint)); } } - set_actNurb(obedit, newnu); BLI_addtail(newnurb, newnu); if (newu != nu->pntsu) newnu->flagu &= ~CU_NURB_CYCLIC; @@ -2110,7 +2106,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, for (b = 0; b < newv; b++) { memcpy(&newnu->bp[b * newu], &nu->bp[b * nu->pntsu], newu * sizeof(BPoint)); } - set_actNurb(obedit, newnu); BLI_addtail(newnurb, newnu); if (newu != nu->pntsu) newnu->flagu &= ~CU_NURB_CYCLIC; @@ -2127,32 +2122,35 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, nu = nu->prev; } - for (nu = newnurb->first; nu; nu = nu->next) { - if (nu->type == CU_BEZIER) { - if (split) { - /* recalc first and last */ - BKE_nurb_handle_calc_simple(nu, &nu->bezt[0]); - BKE_nurb_handle_calc_simple(nu, &nu->bezt[nu->pntsu - 1]); - } - } - else { - /* knots done after duplicate as pntsu may change */ - nu->knotsu = nu->knotsv = NULL; - BKE_nurb_order_clamp_u(nu); - BKE_nurb_knot_calc_u(nu); + if (newnurb->first != NULL) { + cu->lastsel = NULL; + cu->actnu = -1; - if (obedit->type == OB_SURF) { - for (a = 0, bp = nu->bp; a < nu->pntsu * nu->pntsv; a++, bp++) { - bp->f1 &= ~SURF_SEEN; + for (nu = newnurb->first; nu; nu = nu->next) { + if (nu->type == CU_BEZIER) { + if (split) { + /* recalc first and last */ + BKE_nurb_handle_calc_simple(nu, &nu->bezt[0]); + BKE_nurb_handle_calc_simple(nu, &nu->bezt[nu->pntsu - 1]); } + } + else { + /* knots done after duplicate as pntsu may change */ + nu->knotsu = nu->knotsv = NULL; + BKE_nurb_order_clamp_u(nu); + BKE_nurb_knot_calc_u(nu); - BKE_nurb_order_clamp_v(nu); - BKE_nurb_knot_calc_v(nu); + if (obedit->type == OB_SURF) { + for (a = 0, bp = nu->bp; a < nu->pntsu * nu->pntsv; a++, bp++) { + bp->f1 &= ~SURF_SEEN; + } + + BKE_nurb_order_clamp_v(nu); + BKE_nurb_knot_calc_v(nu); + } } } } - - /* actnu changed */ } /**************** switch direction operator ***************/ @@ -6367,6 +6365,7 @@ static int curve_delete_segments(Object *obedit, const bool split) static int curve_delete_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); + Curve *cu = (Curve *)obedit->data; eCurveElem_Types type = RNA_enum_get(op->ptr, "type"); int retval; @@ -6375,6 +6374,9 @@ static int curve_delete_exec(bContext *C, wmOperator *op) else BLI_assert(0); if (retval == OPERATOR_FINISHED) { + cu->lastsel = NULL; + cu->actnu = -1; + if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); |