[Bf-blender-cvs] [64110de] gsoc2016-improved_extrusion: Curves: Fillet and chamfer

João Araújo noreply at git.blender.org
Sun Aug 14 18:11:32 CEST 2016


Commit: 64110dece3eee605422789d485c6814f0acb4317
Author: João Araújo
Date:   Sun Aug 14 17:09:38 2016 +0100
Branches: gsoc2016-improved_extrusion
https://developer.blender.org/rB64110dece3eee605422789d485c6814f0acb4317

Curves: Fillet and chamfer

Fixed a calculation error in the fillet operator. Limited the chamfer algorithm to just run on the points inbetween the first and the last handles, since it makes no sense to chamfer the start of a line. This brings a problem with cyclic splines though, which will be addressed in a later commit.

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

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

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

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4d0bd5f..3a5f2f8 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -8152,7 +8152,7 @@ static int curve_chamfer_exec(bContext *C, wmOperator *op)
 	/* check if handles are vector type! */
 	BezTriple *bezt = nu->bezt, *bezt1, *bezt2, *helper;
 	int selected_point = 0;
-	for (int i = 0; i < nu->pntsu; i++) {
+	for (int i = 1; i < nu->pntsu - 1; i++) {
 		bezt = &nu->bezt[i];
 		if (BEZT_ISSEL_ANY(bezt) && bezt->h1 == 2 && bezt->h2 == 2) {
 			bezt1 = MEM_callocN(sizeof(BezTriple), "curve_chamfer1");
@@ -8446,7 +8446,11 @@ static int curve_fillet_exec(bContext *C, wmOperator *op)
 			normalize_v3(v1);
 			sub_v3_v3v3(v2, bezt->vec[1], bezt->vec[2]);
 			normalize_v3(v2);
-			float angle = angle_normalized_v3v3(v1, v2) / 2;
+			float angle = DEG2RAD(90) - angle_normalized_v3v3(v1, v2) / 2;
+			if (angle < 1.0e-4) {
+				BKE_report(op->reports, RPT_ERROR, "Lines cannot be filleted");
+				return OPERATOR_CANCELLED;
+			}
 			fillet_handle(bezt, bezt1, bezt2, angle, distance);
 			selected_point = i;
 			BKE_nurb_bezierPoints_add(nu, 1);




More information about the Bf-blender-cvs mailing list