[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59080] trunk/blender/source/blender/ blenkernel/intern/curve.c: Fix #36420: ends of curves - caps & twist not good

Sergey Sharybin sergey.vfx at gmail.com
Mon Aug 12 11:00:48 CEST 2013


Revision: 59080
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59080
Author:   nazgul
Date:     2013-08-12 09:00:48 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
Fix #36420: ends of curves - caps & twist not good

Forgot to calculate directions of first/last points
for NURBS and POLY splines.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/curve.c

Modified: trunk/blender/source/blender/blenkernel/intern/curve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/curve.c	2013-08-12 07:48:31 UTC (rev 59079)
+++ trunk/blender/source/blender/blenkernel/intern/curve.c	2013-08-12 09:00:48 UTC (rev 59080)
@@ -2408,6 +2408,23 @@
 	}
 }
 
+static void bevlist_firstlast_direction_calc_from_bpoint(Nurb *nu, BevList *bl)
+{
+	if (nu->pntsu > 1) {
+		BPoint *first_bp = nu->bp, *last_bp = nu->bp + (nu->pntsu - 1);
+		BevPoint *first_bevp, *last_bevp;
+
+		first_bevp = (BevPoint *)(bl + 1);
+		last_bevp = first_bevp + (bl->nr - 1);
+
+		sub_v3_v3v3(first_bevp->dir, (first_bp + 1)->vec, first_bp->vec);
+		normalize_v3(first_bevp->dir);
+
+		sub_v3_v3v3(last_bevp->dir, last_bp->vec, (last_bp - 1)->vec);
+		normalize_v3(last_bevp->dir);
+	}
+}
+
 void BKE_curve_bevelList_make(Object *ob)
 {
 	/*
@@ -2491,6 +2508,10 @@
 					bevp++;
 					bp++;
 				}
+
+				if ((nu->flagu & CU_NURB_CYCLIC) == 0) {
+					bevlist_firstlast_direction_calc_from_bpoint(nu, bl);
+				}
 			}
 			else if (nu->type == CU_BEZIER) {
 				/* in case last point is not cyclic */
@@ -2601,6 +2622,10 @@
 					                   do_radius    ? &bevp->radius : NULL,
 					                   do_weight    ? &bevp->weight : NULL,
 					                   resolu, sizeof(BevPoint));
+
+					if ((nu->flagu & CU_NURB_CYCLIC) == 0) {
+						bevlist_firstlast_direction_calc_from_bpoint(nu, bl);
+					}
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list