[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12518] branches/particles/source/blender: As a left over from unified baking softbody could be enabled in edit mode, which led to a crash when mesh structure was changed in edit mode.

Janne Karhu jhkarh at utu.fi
Wed Nov 7 23:55:01 CET 2007


Revision: 12518
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12518
Author:   jhk
Date:     2007-11-07 23:55:01 +0100 (Wed, 07 Nov 2007)

Log Message:
-----------
As a left over from unified baking softbody could be enabled in edit mode, which led to a crash when mesh structure was changed in edit mode.
Too much cleaning had gotten rid of some still used code in loading hair softbody.
Wrong order of matrix multiplication in hair space conversions resulted in funky results on "not default cube" :)

Modified Paths:
--------------
    branches/particles/source/blender/blenkernel/intern/modifier.c
    branches/particles/source/blender/blenkernel/intern/particle.c
    branches/particles/source/blender/blenloader/intern/readfile.c

Modified: branches/particles/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/modifier.c	2007-11-07 21:45:35 UTC (rev 12517)
+++ branches/particles/source/blender/blenkernel/intern/modifier.c	2007-11-07 22:55:01 UTC (rev 12518)
@@ -4863,12 +4863,6 @@
 {
 	sbObjectStep(ob, (float)G.scene->r.cfra, vertexCos, numVerts);
 }
-static void softbodyModifier_deformVertsEM(
-                ModifierData *md, Object *ob, EditMesh *editData,
-                DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
-{
-	sbObjectStep(ob, (float)G.scene->r.cfra, vertexCos, numVerts);
-}
 
 /* Boolean */
 
@@ -6428,11 +6422,8 @@
 		mti = INIT_TYPE(Softbody);
 		mti->type = eModifierTypeType_OnlyDeform;
 		mti->flags = eModifierTypeFlag_AcceptsCVs
-		             | eModifierTypeFlag_RequiresOriginalData
-					 | eModifierTypeFlag_SupportsEditmode
-					 | eModifierTypeFlag_EnableInEditmode;
+		             | eModifierTypeFlag_RequiresOriginalData;
 		mti->deformVerts = softbodyModifier_deformVerts;
-		mti->deformVertsEM = softbodyModifier_deformVertsEM;
 
 		mti = INIT_TYPE(Boolean);
 		mti->type = eModifierTypeType_Nonconstructive;

Modified: branches/particles/source/blender/blenkernel/intern/particle.c
===================================================================
--- branches/particles/source/blender/blenkernel/intern/particle.c	2007-11-07 21:45:35 UTC (rev 12517)
+++ branches/particles/source/blender/blenkernel/intern/particle.c	2007-11-07 22:55:01 UTC (rev 12518)
@@ -2319,7 +2319,7 @@
 
 	psys_mat_hair_to_object(dm, deform_only, from, pa, facemat);
 
-	Mat4MulMat4(hairmat, ob->obmat, facemat);
+	Mat4MulMat4(hairmat, facemat, ob->obmat);
 }
 /************************************************/
 /*			ParticleSettings handling			*/

Modified: branches/particles/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/particles/source/blender/blenloader/intern/readfile.c	2007-11-07 21:45:35 UTC (rev 12517)
+++ branches/particles/source/blender/blenloader/intern/readfile.c	2007-11-07 22:55:01 UTC (rev 12518)
@@ -2500,7 +2500,7 @@
 	ParticleSystem *psys;
 	int a;
 
-	for(psys=particles->first; psys; psys=psys->next){
+	for(psys=particles->first; psys; psys=psys->next) {
 		psys->particles=newdataadr(fd,psys->particles);
 		if(psys->particles && psys->particles->hair){
 			ParticleData *pa = psys->particles;
@@ -2511,25 +2511,14 @@
 		psys->effectors.first=psys->effectors.last=0;
 
 		psys->soft= newdataadr(fd, psys->soft);
-		//if(psys->soft) {
-		//	SoftBody *sb= psys->soft;
+		if(psys->soft) {
+			SoftBody *sb = psys->soft;
+			sb->particles = psys;
+			sb->bpoint= NULL;	// init pointers so it gets rebuilt nicely
+			sb->bspring= NULL;
+			sb->scratch= NULL;
+		}
 
-		//	sb->particles = psys;
-		//	
-		//	sb->bpoint= NULL;	// init pointers so it gets rebuilt nicely
-		//	sb->bspring= NULL;
-		//	sb->scratch= NULL;
-
-		//	
-		//	sb->keys= newdataadr(fd, sb->keys);
-		//	test_pointer_array(fd, (void **)&sb->keys);
-		//	if(sb->keys) {
-		//		for(a=0; a<sb->totkey; a++) {
-		//			sb->keys[a]= newdataadr(fd, sb->keys[a]);
-		//		}
-		//	}
-		//}
-
 		psys->edit = 0;
 		psys->pathcache = 0;
 		psys->childcache = 0;
@@ -3095,7 +3084,8 @@
 		sb->bspring= NULL;
 		sb->scratch= NULL;
 
-		
+		/* although not used anymore */
+		/* still have to be loaded to be compatible with old files */
 		sb->keys= newdataadr(fd, sb->keys);
 		test_pointer_array(fd, (void **)&sb->keys);
 		if(sb->keys) {





More information about the Bf-blender-cvs mailing list