diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-04 10:47:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-05 11:36:14 +0300 |
commit | a5cfe0f9dcb213d2f81eaebaff37aec6b8fb0c42 (patch) | |
tree | 7f15265d97cbcb90563f53c019b6aa557ba48039 /source/blender | |
parent | e63a8e7ded3953038654387b9a88a1552d6217f6 (diff) |
Fix curve adding 3D nurbs when 2D is set
Ctrl-LMB ignored 2D constraint
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 55e571e58ed..268804ee8dd 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4767,7 +4767,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb) /***************** add vertex operator **********************/ -static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float location[3]) +static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float location_init[3]) { Nurb *nu; @@ -4808,7 +4808,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat int i; mid_v3_v3v3(center, minmax[0], minmax[1]); - sub_v3_v3v3(ofs, location, center); + sub_v3_v3v3(ofs, location_init, center); if ((cu->flag & CU_3D) == 0) { ofs[2] = 0.0f; @@ -4846,6 +4846,14 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat changed = true; } else { + float location[3]; + + copy_v3_v3(location, location_init); + + if ((cu->flag & CU_3D) == 0) { + location[2] = 0.0f; + } + /* nothing selected: create a new curve */ nu = BKE_curve_nurb_active_get(cu); @@ -4863,6 +4871,10 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat nurb_new->orderu = 4; nurb_new->flag |= CU_SMOOTH; BKE_nurb_bezierPoints_add(nurb_new, 1); + + if ((cu->flag & CU_3D) == 0) { + nurb_new->flag |= CU_2D; + } } BLI_addtail(&editnurb->nurbs, nurb_new); @@ -4894,6 +4906,10 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat nurb_new->flag |= CU_SMOOTH; nurb_new->orderu = 4; BKE_nurb_points_add(nurb_new, 1); + + if ((cu->flag & CU_3D) == 0) { + nurb_new->flag |= CU_2D; + } } BLI_addtail(&editnurb->nurbs, nurb_new); |