[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12079] branches/cloth/blender/source/ blender: Temporary fix for loading crash of .blends with cached frames.

Daniel Genrich daniel.genrich at gmx.net
Tue Sep 18 09:16:57 CEST 2007


Revision: 12079
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12079
Author:   genscher
Date:     2007-09-18 09:16:57 +0200 (Tue, 18 Sep 2007)

Log Message:
-----------
Temporary fix for loading crash of .blends with cached frames. Also fixed some goal behavior/init problem to match SB behaviour

Modified Paths:
--------------
    branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
    branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
    branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
    branches/cloth/blender/source/blender/blenloader/intern/readfile.c
    branches/cloth/blender/source/blender/blenloader/intern/writefile.c

Modified: branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/cloth.c	2007-09-18 06:41:29 UTC (rev 12078)
+++ branches/cloth/blender/source/blender/blenkernel/intern/cloth.c	2007-09-18 07:16:57 UTC (rev 12079)
@@ -913,13 +913,10 @@
 	verts = clothObj->verts;
 
 	for (i = 0; i < numverts; i++, verts++)
-	{				
-		/* so this will definily be below SOFTGOALSNAP */
-		verts->goal= 0.0f; 
-		
+	{					
 		// LATER ON, support also mass painting here
 		if(clmd->sim_parms.flags & CSIMSETT_FLAG_GOAL) 
-		{			
+		{						
 			dvert = dm->getVertData(dm, i, CD_MDEFORMVERT);
 			if(dvert)	
 			{		
@@ -1211,7 +1208,12 @@
 				Mat4MulVecfl(ob->obmat, verts->x);
 
 				verts->mass = clmd->sim_parms.mass;
-				verts->goal= clmd->sim_parms.defgoal;
+				
+				if(clmd->sim_parms.flags & CSIMSETT_FLAG_GOAL) 
+					verts->goal= clmd->sim_parms.defgoal;
+				else
+					verts->goal= 0.0f;
+				
 				verts->flags = 0;
 				VECCOPY(verts->xold, verts->x);
 				VECCOPY(verts->xconst, verts->x);

Modified: branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-09-18 06:41:29 UTC (rev 12078)
+++ branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-09-18 07:16:57 UTC (rev 12079)
@@ -570,7 +570,7 @@
 /* STATUS: verified */
 DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, float (*fLongVector)[3])
 {
-	int i = 0,j=0;
+	unsigned int i = 0,j=0;
 	zero_lfvector(to, from[0].vcount);
 	/* process diagonal elements */	
 	for(i = 0; i < from[0].vcount; i++)

Modified: branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/modifier.c	2007-09-18 06:41:29 UTC (rev 12078)
+++ branches/cloth/blender/source/blender/blenkernel/intern/modifier.c	2007-09-18 07:16:57 UTC (rev 12079)
@@ -4873,6 +4873,7 @@
 	DerivedMesh *dm = NULL;
 
 	// if possible use/create DerivedMesh
+	
 	if(derivedData) dm = CDDM_copy(derivedData);
 	else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
 	

Modified: branches/cloth/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/cloth/blender/source/blender/blenloader/intern/readfile.c	2007-09-18 06:41:29 UTC (rev 12078)
+++ branches/cloth/blender/source/blender/blenloader/intern/readfile.c	2007-09-18 07:16:57 UTC (rev 12079)
@@ -2878,11 +2878,13 @@
 		   ClothModifierData	*clmd = (ClothModifierData*) md;
 
 		   clmd->clothObject = NULL;
-			/*
-		   if (clmd->sim_parms.flags & CSIMSETT_FLAG_BAKED) {
-			  clmd->baked_data = newdataadr (fd, clmd->baked_data);
+		   clmd->sim_parms.cache = NULL;
+		
+		   if (clmd->sim_parms.cache) {
+			   // TODO 
+			  // clmd->cache = newdataadr (fd, clmd->cache);
 			  printf ("direct_link_modifiers: read cloth baked_data.\n");
-		   }*/
+		   }
 		} 
 		else if (md->type==eModifierType_Hook) {
 			HookModifierData *hmd = (HookModifierData*) md;

Modified: branches/cloth/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/cloth/blender/source/blender/blenloader/intern/writefile.c	2007-09-18 06:41:29 UTC (rev 12078)
+++ branches/cloth/blender/source/blender/blenloader/intern/writefile.c	2007-09-18 07:16:57 UTC (rev 12079)
@@ -813,6 +813,23 @@
 
 }
 
+/*
+// TODO: finish this
+static void write_cloth_cache(WriteData *wd, LinkNode *ln)
+{
+	
+	while(ln) {
+		writestruct(wd, DATA, "cloth_cache", 1, ln);		
+		writestruct(wd, DATA, "cloth_cache_frame", 1, ln->link);
+		writestruct(wd, DATA, "cloth_cache_frame_verts", 1, ln->link);
+		writestruct(wd, DATA, "cloth_cache_frame_springs", 1, ln->link);
+		}
+
+		ln = ln->next;
+	}
+}
+*/
+		
 static void write_modifiers(WriteData *wd, ListBase *modbase)
 {
 	ModifierData *md;
@@ -832,16 +849,20 @@
 	else if (md->type==eModifierType_Cloth) {
 		   int					n;
 		   ClothModifierData	*clmd = (ClothModifierData *) md;
-		/*
-		   if ((clmd->sim_parms.flags & CSIMSETT_FLAG_BAKED) && clmd->baked_data) {
+
+		   if (clmd->sim_parms.cache) {
 			  // Compute the number of vertices we're saving.
-			   
+			   // TODO
+			   // write_cloth_cache();
+			  /*
+			   // old code
 			  n = (clmd->sim_parms.bake_end_frame - clmd->sim_parms.bake_start_frame + 1) *
 				 clmd->sim_parms.bake_num_verts;
 			  writedata (wd, DATA, n *  sizeof (clmd->baked_data [0]), clmd->baked_data);
 			  printf ("write_modifiers: wrote %d elements of size %d for cloth baked data.\n",
 					  n, sizeof (clmd->baked_data [0]));
-		   }*/
+			   */
+		   }
 		}
 	}
 }





More information about the Bf-blender-cvs mailing list