diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-16 07:10:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-16 07:10:15 +0400 |
commit | c00c0134e0f40748885a6bbd5ef8b4ffb7c34f09 (patch) | |
tree | f649494ce560f248505225b3d29972a58b1e91b5 /source/blender/editors/curve/editcurve.c | |
parent | e6e265b2b59e02cc7816a2ed43471eca8bca0a62 (diff) | |
parent | 9f46ca46a6fcdacf53d95a61147272352154204b (diff) |
svn merge -r41847:41899 ^/trunk/blender
Diffstat (limited to 'source/blender/editors/curve/editcurve.c')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index a7fb046737d..38b786e306e 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5468,6 +5468,24 @@ static int point_on_nurb(Nurb *nu, void *point) } } +static Nurb *get_lastsel_nurb(Curve *cu) +{ + ListBase *nubase= curve_editnurbs(cu); + Nurb *nu= nubase->first; + + if(!cu->lastsel) + return NULL; + + while (nu) { + if (point_on_nurb(nu, cu->lastsel)) + return nu; + + nu= nu->next; + } + + return NULL; +} + static void select_nth_bezt(Nurb *nu, BezTriple *bezt, int nth) { int a, start; @@ -5517,21 +5535,11 @@ static void select_nth_bp(Nurb *nu, BPoint *bp, int nth) int CU_select_nth(Object *obedit, int nth) { Curve *cu= (Curve*)obedit->data; - ListBase *nubase= curve_editnurbs(cu); Nurb *nu; - int ok=0; - - /* Search nurb to which selected point belongs to */ - nu= nubase->first; - while (nu) { - if (point_on_nurb(nu, cu->lastsel)) { - ok= 1; - break; - } - nu= nu->next; - } - if (!ok) return 0; + nu= get_lastsel_nurb(cu); + if (!nu) + return 0; if (nu->bezt) { select_nth_bezt(nu, cu->lastsel, nth); @@ -7069,3 +7077,24 @@ void ED_curve_bpcpy(EditNurb *editnurb, BPoint *dst, BPoint *src, int count) memcpy(dst, src, count*sizeof(BPoint)); keyIndex_updateBP(editnurb, src, dst, count); } + +int ED_curve_actSelection(Curve *cu, float center[3]) +{ + Nurb *nu= get_lastsel_nurb(cu); + + if(!nu) + return 0; + + if(nu->bezt) { + BezTriple *bezt= cu->lastsel; + + copy_v3_v3(center, bezt->vec[1]); + } + else { + BPoint *bp= cu->lastsel; + + copy_v3_v3(center, bp->vec); + } + + return 1; +} |