[Bf-blender-cvs] [f4875be] master: Fix curve editmode adding 3D primitives w/ 2D curves

Campbell Barton noreply at git.blender.org
Mon Apr 4 10:36:52 CEST 2016


Commit: f4875bed89de6500f333df3a87001919e95ec346
Author: Campbell Barton
Date:   Mon Apr 4 18:34:04 2016 +1000
Branches: master
https://developer.blender.org/rBf4875bed89de6500f333df3a87001919e95ec346

Fix curve editmode adding 3D primitives w/ 2D curves

===================================================================

M	source/blender/editors/curve/editcurve_add.c

===================================================================

diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c
index 246f089..cc8e272 100644
--- a/source/blender/editors/curve/editcurve_add.c
+++ b/source/blender/editors/curve/editcurve_add.c
@@ -121,7 +121,6 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
 	const float grid = 1.0f;
 	const int cutype = (type & CU_TYPE); // poly, bezier, nurbs, etc
 	const int stype = (type & CU_PRIMITIVE);
-	const bool force_3d = (((Curve *)obedit->data)->flag & CU_3D) != 0; /* could be adding to an existing 3D curve */
 
 	unit_m4(umat);
 	unit_m4(viewmat);
@@ -145,7 +144,6 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
 		case CU_PRIM_CURVE: /* curve */
 			nu->resolu = cu->resolu;
 			if (cutype == CU_BEZIER) {
-				if (!force_3d) nu->flag |= CU_2D;
 				nu->pntsu = 2;
 				nu->bezt = (BezTriple *)MEM_callocN(2 * sizeof(BezTriple), "addNurbprim1");
 				bezt = nu->bezt;
@@ -247,7 +245,6 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
 			nu->resolu = cu->resolu;
 
 			if (cutype == CU_BEZIER) {
-				if (!force_3d) nu->flag |= CU_2D;
 				nu->pntsu = 4;
 				nu->bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple) * 4, "addNurbprim1");
 				nu->flagu = CU_NURB_CYCLIC;
@@ -459,6 +456,10 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
 	BLI_assert(nu != NULL);
 
 	if (nu) { /* should always be set */
+		if ((obedit->type != OB_SURF) && ((cu->flag & CU_3D) == 0)) {
+			nu->flag |= CU_2D;
+		}
+
 		nu->flag |= CU_SMOOTH;
 		cu->actnu = BLI_listbase_count(editnurb);
 		cu->actvert = CU_ACT_NONE;




More information about the Bf-blender-cvs mailing list