Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-15 10:37:47 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-15 10:37:47 +0400
commite8906f5254cdedb0dcbfab31a800ba1f9ed860f5 (patch)
tree495ef9912afeb4623681998cb153673d45102a95 /source/blender/editors/curve
parent4371db4b3340a193f99c35941243cc206ea7de95 (diff)
Fix #29253: 3D Manipulator: "Active Element" not supported for curves
This funcitonality simply wasn't implemented for curves yet, implemented it now.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 1f6673137a1..1415b8965fe 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);
@@ -7070,3 +7078,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;
+}