[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32021] trunk/blender/source/blender/ blenkernel/intern/anim.c: bugfix [#20576] Curve modifier and loop cut

Campbell Barton ideasman42 at gmail.com
Mon Sep 20 11:09:03 CEST 2010


Revision: 32021
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32021
Author:   campbellbarton
Date:     2010-09-20 11:09:00 +0200 (Mon, 20 Sep 2010)

Log Message:
-----------
bugfix [#20576] Curve modifier and loop cut
Quaternion interpolation was skipped which gave ugly stepping with the curve modifier (broke with my curve twist fix)

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

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2010-09-20 06:47:34 UTC (rev 32020)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2010-09-20 09:09:00 UTC (rev 32021)
@@ -640,29 +640,19 @@
 	/* Need to verify the quat interpolation is correct - XXX */
 
 	if (quat) {
-		//float totfac, q1[4], q2[4];
+		float totfac, q1[4], q2[4];
 
-		/* checks for totfac are needed when 'fac' is 1.0 key_curve_position_weights can assign zero
-		 * to more then one index in data which can give divide by zero error */
-/*
-		totfac= data[0]+data[1];
-		if(totfac>0.000001)	interp_qt_qtqt(q1, p0->quat, p1->quat, data[0] / totfac);
-		else				QUATCOPY(q1, p1->quat);
+		totfac= data[0]+data[3];
+		if(totfac>FLT_EPSILON)	interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
+		else					QUATCOPY(q1, p1->quat);
 
-		normalize_qt(q1);
+		totfac= data[1]+data[2];
+		if(totfac>FLT_EPSILON)	interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
+		else					QUATCOPY(q1, p3->quat);
 
-		totfac= data[2]+data[3];
-		if(totfac>0.000001)	interp_qt_qtqt(q2, p2->quat, p3->quat, data[2] / totfac);
-		else				QUATCOPY(q1, p3->quat);
-		normalize_qt(q2);
-
 		totfac = data[0]+data[1]+data[2]+data[3];
-		if(totfac>0.000001)	interp_qt_qtqt(quat, q1, q2, (data[0]+data[1]) / totfac);
-		else				QUATCOPY(quat, q2);
-		normalize_qt(quat);
-		*/
-		// XXX - find some way to make quat interpolation work correctly, above code fails in rare but nasty cases.
-		QUATCOPY(quat, p1->quat);
+		if(totfac>FLT_EPSILON)	interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
+		else					QUATCOPY(quat, q2);
 	}
 
 	if(radius)





More information about the Bf-blender-cvs mailing list