[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23171] branches/blender2.4/source/blender : remove minimal twist from 2.4x, is too much in development which changed in 2.5, better keep in 2. 5x then try have them in sync.

Campbell Barton ideasman42 at gmail.com
Sun Sep 13 09:35:31 CEST 2009


Revision: 23171
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23171
Author:   campbellbarton
Date:     2009-09-13 09:35:31 +0200 (Sun, 13 Sep 2009)

Log Message:
-----------
remove minimal twist from 2.4x, is too much in development which changed in 2.5, better keep in 2.5x then try have them in sync.

Modified Paths:
--------------
    branches/blender2.4/source/blender/blenkernel/intern/curve.c
    branches/blender2.4/source/blender/makesdna/DNA_curve_types.h
    branches/blender2.4/source/blender/src/buttons_editing.c

Modified: branches/blender2.4/source/blender/blenkernel/intern/curve.c
===================================================================
--- branches/blender2.4/source/blender/blenkernel/intern/curve.c	2009-09-13 07:19:33 UTC (rev 23170)
+++ branches/blender2.4/source/blender/blenkernel/intern/curve.c	2009-09-13 07:35:31 UTC (rev 23171)
@@ -1835,106 +1835,6 @@
 				Mat3CpyMat3(bevp2->mat, bevp1->mat);
 			}
 
-		}	/* this has to be >2 points */
-		else if(cu->flag & CU_NO_TWIST && cu->flag & CU_3D && bl->poly != -1) {
-
-			/* Special case, cyclic curve with no twist. tricky... */
-
-			float quat[4], q[4], cross[3];
-
-			/* correcting a cyclic curve is more complicated, need to be corrected from both ends */
-			float *quat_tmp1, *quat_tmp2; /* store a quat in the matrix temporarily */
-			int iter_dir;
-			BevPoint *bevp_start= (BevPoint *)(bl+1);
-
-			/* loop over the points twice, once up, once back, accumulate the quat rotations
-			 * in both directions, then blend them in the 3rd loop and apply the tilt */
-			for(iter_dir = 0; iter_dir < 2; iter_dir++) {
-
-				bevp2= (BevPoint *)(bl+1);
-				bevp1= bevp2+(bl->nr-1);
-				bevp0= bevp1-1;
-
-				nr= bl->nr;
-				while(nr--) {
-	
-					/* Normalizes */
-					VecBisect3(vec, bevp0->vec, bevp1->vec, bevp2->vec);
-
-					if(bl->nr==nr+1) { /* first time */
-						vectoquat(vec, 5, 1, quat);
-					}
-					else {
-						float angle = NormalizedVecAngle2(vec_prev, vec);
-					
-						if(angle > 0.0f) { /* otherwise we can keep as is */
-							Crossf(cross, vec_prev, vec);
-							AxisAngleToQuat(q, cross, angle);
-							QuatMul(quat, q, quat_prev);
-						}
-						else {
-							QUATCOPY(quat, quat_prev);
-						}
-					}
-					QUATCOPY(quat_prev, quat); /* quat_prev can't have the tilt applied */
-					VECCOPY(vec_prev, vec);
-
-					if(iter_dir==0) { /* up, first time */
-						quat_tmp1= (float *)bevp1->mat;
-
-						bevp0= bevp1;
-						bevp1= bevp2;
-						bevp2++;
-					}
-					else { /* down second time */
-						quat_tmp1= ((float *)bevp1->mat)+4;
-
-						bevp2= bevp1;
-						bevp1= bevp0;
-						bevp0--;
-
-						/* wrap around */
-						if (bevp0 < bevp_start)
-							bevp0= bevp_start+(bl->nr-1);
-					}
-
-					QUATCOPY(quat_tmp1, quat);
-				}
-			}
-
-			/* Now interpolate the 2 quats and apply tilt */
-
-			bevp2= (BevPoint *)(bl+1);
-			bevp1= bevp2+(bl->nr-1);
-			bevp0= bevp1-1;
-
-			nr= bl->nr;
-			while(nr--) {
-
-				VecBisect3(vec, bevp0->vec, bevp1->vec, bevp2->vec);
-
-				quat_tmp1= (float *)bevp1->mat;
-				quat_tmp2= quat_tmp1+4;
-
-				/* blend the 2 rotations gathered from both directions */
-				QuatInterpol(quat, quat_tmp1, quat_tmp2, 1.0 - (((float)nr)/bl->nr));
-
-				AxisAngleToQuat(q, vec, bevp1->alfa);
-				QuatMul(quat, q, quat);
-				QuatToMat3(quat, bevp1->mat);
-				
-				/* generic */
-				x1= bevp1->vec[0]- bevp0->vec[0];
-				x2= bevp1->vec[0]- bevp2->vec[0];
-				y1= bevp1->vec[1]- bevp0->vec[1];
-				y2= bevp1->vec[1]- bevp2->vec[1];
-			
-				calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa));
-				
-				bevp0= bevp1;
-				bevp1= bevp2;
-				bevp2++;
-			}
 		}
 		else {
 			/* Any curve with 3 or more points */
@@ -1951,21 +1851,8 @@
 					/* Normalizes */
 					VecBisect3(vec, bevp0->vec, bevp1->vec, bevp2->vec);
 
-					if(bl->nr==nr+1 || !(cu->flag & CU_NO_TWIST)) { /* first time */
-						vectoquat(vec, 5, 1, quat);
-					}
-					else {
-						float angle = NormalizedVecAngle2(vec_prev, vec);
-
-						if(angle > 0.0f) { /* otherwise we can keep as is */
-							Crossf(cross, vec_prev, vec);
-							AxisAngleToQuat(q, cross, angle);
-							QuatMul(quat, q, quat_prev);
-						}
-						else {
-							QUATCOPY(quat, quat_prev);
-						}
-					}
+					vectoquat(vec, 5, 1, quat);
+					
 					QUATCOPY(quat_prev, quat); /* quat_prev can't have the tilt applied */
 					VECCOPY(vec_prev, vec);
 					
@@ -1981,7 +1868,6 @@
 
 				calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa));
 
-
 				bevp0= bevp1;
 				bevp1= bevp2;
 				bevp2++;
@@ -1989,19 +1875,17 @@
 
 			/* correct non-cyclic cases */
 			if(bl->poly== -1) {
-				if(bl->nr>2) {
-					bevp= (BevPoint *)(bl+1);
-					bevp1= bevp+1;
-					bevp->sina= bevp1->sina;
-					bevp->cosa= bevp1->cosa;
-					Mat3CpyMat3(bevp->mat, bevp1->mat);
-					bevp= (BevPoint *)(bl+1);
-					bevp+= (bl->nr-1);
-					bevp1= bevp-1;
-					bevp->sina= bevp1->sina;
-					bevp->cosa= bevp1->cosa;
-					Mat3CpyMat3(bevp->mat, bevp1->mat);
-				}
+				bevp= (BevPoint *)(bl+1);
+				bevp1= bevp+1;
+				bevp->sina= bevp1->sina;
+				bevp->cosa= bevp1->cosa;
+				Mat3CpyMat3(bevp->mat, bevp1->mat);
+				bevp= (BevPoint *)(bl+1);
+				bevp+= (bl->nr-1);
+				bevp1= bevp-1;
+				bevp->sina= bevp1->sina;
+				bevp->cosa= bevp1->cosa;
+				Mat3CpyMat3(bevp->mat, bevp1->mat);
 			}
 		}
 		bl= bl->next;

Modified: branches/blender2.4/source/blender/makesdna/DNA_curve_types.h
===================================================================
--- branches/blender2.4/source/blender/makesdna/DNA_curve_types.h	2009-09-13 07:19:33 UTC (rev 23170)
+++ branches/blender2.4/source/blender/makesdna/DNA_curve_types.h	2009-09-13 07:35:31 UTC (rev 23171)
@@ -205,8 +205,6 @@
 #define CU_FAST			512 /* Font: no filling inside editmode */
 #define CU_RETOPO               1024
 
-#define CU_NO_TWIST		4096
-
 /* spacemode */
 #define CU_LEFT			0
 #define CU_MIDDLE		1

Modified: branches/blender2.4/source/blender/src/buttons_editing.c
===================================================================
--- branches/blender2.4/source/blender/src/buttons_editing.c	2009-09-13 07:19:33 UTC (rev 23170)
+++ branches/blender2.4/source/blender/src/buttons_editing.c	2009-09-13 07:35:31 UTC (rev 23171)
@@ -3671,8 +3671,7 @@
 		uiBlockSetCol(block, TH_BUT_SETTING1);
 		uiDefButBitS(block, TOG, CU_BACK, B_MAKEDISP, "Back",	760,115,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled back for extruded/beveled curves");
 		uiDefButBitS(block, TOG, CU_FRONT, B_MAKEDISP, "Front",810,115,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled front for extruded/beveled curves");
-		uiDefButBitS(block, TOG, CU_3D, B_CU3D, "3D",		860,115,30,19, &cu->flag, 0, 0, 0, 0, "Allow Curve to be 3d, it doesn't fill then");
-		uiDefIconButBitS(block, TOG, CU_NO_TWIST, B_MAKEDISP, ICON_AUTO,	890,115,20,19, &cu->flag, 0.0, 0.0, 0, 0, "Avoid twisting artifacts for 3D beveled/extruded curves");
+		uiDefButBitS(block, TOG, CU_3D, B_CU3D, "3D",		860,115,50,19, &cu->flag, 0, 0, 0, 0, "Allow Curve to be 3d, it doesn't fill then");
 	}
 }
 





More information about the Bf-blender-cvs mailing list