[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13598] trunk/blender/source/blender/ blenkernel/intern: Cloth: 1.

Daniel Genrich daniel.genrich at gmx.net
Wed Feb 6 23:59:56 CET 2008


Revision: 13598
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13598
Author:   genscher
Date:     2008-02-06 23:59:56 +0100 (Wed, 06 Feb 2008)

Log Message:
-----------
Cloth: 1. fix problem with pinning (reported by ZanQdo), 2. fix cache protected + 'not saved' gui message bug (reported by Tobias Regenbrecht)

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

Modified: trunk/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cloth.c	2008-02-06 22:45:46 UTC (rev 13597)
+++ trunk/blender/source/blender/blenkernel/intern/cloth.c	2008-02-06 22:59:56 UTC (rev 13598)
@@ -761,8 +761,8 @@
 		return result;
 	}
 	
-	// check for autoprotection
-	if(framenr >= clmd->sim_parms->autoprotect)
+	// check for autoprotection, but only if cache active
+	if((framenr >= clmd->sim_parms->autoprotect) && (G.relbase_valid))
 	{
 		if(G.rt > 0)
 			printf("fr#: %f, auto: %d\n", framenr, clmd->sim_parms->autoprotect);
@@ -1073,7 +1073,9 @@
 						
 						verts->goal  = ( float ) pow ( verts->goal , 4.0f );
 						if ( verts->goal >=SOFTGOALSNAP )
-							verts->flags |= CLOTH_VERT_FLAG_PINNED;
+						{
+ 							verts->flags |= CLOTH_VERT_FLAG_PINNED;
+						}
 					}
 					
 					if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING )
@@ -1089,11 +1091,13 @@
 							verts->bend_stiff = dvert->dw [j].weight;
 						}
 					}
-					
-					if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_mass-1))
+					/*
+					// for later
+					if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1))
 					{
 						verts->mass = dvert->dw [j].weight;
 					}
+					*/
 				}
 			}
 		}

Modified: trunk/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/implicit.c	2008-02-06 22:45:46 UTC (rev 13597)
+++ trunk/blender/source/blender/blenkernel/intern/implicit.c	2008-02-06 22:59:56 UTC (rev 13598)
@@ -60,7 +60,7 @@
 #include "BKE_modifier.h"
 #include "BKE_utildefines.h"
 #include "BKE_global.h"
-#include  "BIF_editdeform.h"
+#include "BIF_editdeform.h"
 
 
 #ifdef _WIN32
@@ -111,9 +111,6 @@
 }
 #endif
 
-/* callbacks for errors and interrupts and some goo */
-static int (*CT_localInterruptCallBack)(void) = NULL;
-
 static float I[3][3] = {{1,0,0},{0,1,0},{0,0,1}};
 static float ZERO[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
 
@@ -783,7 +780,7 @@
 	{
 		id->A[i].r = id->A[i].c = id->dFdV[i].r = id->dFdV[i].c = id->dFdX[i].r = id->dFdX[i].c = id->P[i].c = id->P[i].r = id->Pinv[i].c = id->Pinv[i].r = id->bigI[i].c = id->bigI[i].r = id->M[i].r = id->M[i].c = i;
 
-		if(verts [i].goal >= SOFTGOALSNAP)
+		if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 		{
 			id->S[pinned].pinned = 1;
 			id->S[pinned].c = id->S[pinned].r = i;
@@ -1337,6 +1334,7 @@
 	submul_lfvectorS(lF, lV, spring_air, numverts);
 		
 	/* do goal stuff */
+	/*
 	if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) 
 	{	
 		for(i = 0; i < numverts; i++)
@@ -1353,15 +1351,13 @@
 				VECADDS(lF[i], lF[i], auxvect, -ks);
 
 				// calulate damping forces generated by goals
-				
 				VECSUB(velgoal,verts[i].xold, verts[i].xconst);
 				kd =  clmd->sim_parms->goalfrict * 0.01f; // friction force scale taken from SB
 				VECSUBADDSS(lF[i], velgoal, kd, lV[i], kd);
-				
-				
 			}
 		}	
 	}
+	*/
 	
 	/* handle external forces like wind */
 	if(effectors)
@@ -1459,7 +1455,7 @@
 		for(i = 0; i < numverts; i++)
 		{			
 			// update velocities with constrained velocities from pinned verts
-			if(verts [i].goal >= SOFTGOALSNAP)
+			if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 			{			
 				VECSUB(id->V[i], verts[i].xconst, verts[i].xold);
 				// VecMulf(id->V[i], 1.0 / dt);
@@ -1500,7 +1496,7 @@
 				
 				if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) 
 				{			
-					if(verts [i].goal >= SOFTGOALSNAP)
+					if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 					{			
 						float tvect[3] = {.0,.0,.0};
 						// VECSUB(tvect, id->Xnew[i], verts[i].xold);
@@ -1528,7 +1524,7 @@
 					
 					if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) 
 					{			
-						if(verts [i].goal >= SOFTGOALSNAP)
+						if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 						{
 							continue;
 						}
@@ -1580,12 +1576,6 @@
 
 		if(effectors) pdEndEffectors(effectors);
 		
-		/* ask for user break */ 
-		/*
-		don't work very well, gives problems with ctrl-a + esc
-		if (CT_localInterruptCallBack && CT_localInterruptCallBack())
-			return 0;
-		*/
 	}
 
 	for(i = 0; i < numverts; i++)
@@ -1631,8 +1621,3 @@
 		printf("implicit_set_positions\n");	
 }
 
-/* Cloth global visible functions */ 
-void clmdSetInterruptCallBack(int (*f)(void))
-{
-	CT_localInterruptCallBack = f;
-}





More information about the Bf-blender-cvs mailing list