[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13576] trunk/blender/source/blender: Cloth: Fix for crash with meshes with no faces, 2.

Daniel Genrich daniel.genrich at gmx.net
Tue Feb 5 16:09:48 CET 2008


Revision: 13576
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13576
Author:   genscher
Date:     2008-02-05 16:09:48 +0100 (Tue, 05 Feb 2008)

Log Message:
-----------
Cloth: Fix for crash with meshes with no faces, 2. Fix for crash on switching from to another mesh

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/cloth.c
    trunk/blender/source/blender/blenkernel/intern/collision.c
    trunk/blender/source/blender/src/buttons_object.c

Modified: trunk/blender/source/blender/blenkernel/intern/cloth.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cloth.c	2008-02-05 14:11:48 UTC (rev 13575)
+++ trunk/blender/source/blender/blenkernel/intern/cloth.c	2008-02-05 15:09:48 UTC (rev 13576)
@@ -51,6 +51,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
+#include "BLI_editVert.h"
 #include "BLI_edgehash.h"
 #include "BLI_linklist.h"
 
@@ -203,6 +204,10 @@
 	
 	verts = cloth->verts;
 	
+	// in the moment, return zero if no faces there
+	if(!cloth->numfaces)
+		return NULL;
+	
 	bvh = MEM_callocN(sizeof(BVH), "BVH");
 	if (bvh == NULL) 
 	{

Modified: trunk/blender/source/blender/blenkernel/intern/collision.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/collision.c	2008-02-05 14:11:48 UTC (rev 13575)
+++ trunk/blender/source/blender/blenkernel/intern/collision.c	2008-02-05 15:09:48 UTC (rev 13576)
@@ -101,6 +101,10 @@
 		return NULL;
 	}
 	
+	// in the moment, return zero if no faces there
+	if(!numfaces)
+		return NULL;
+	
 	bvh->flags = 0;
 	bvh->leaf_tree = NULL;
 	bvh->leaf_root = NULL;

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c	2008-02-05 14:11:48 UTC (rev 13575)
+++ trunk/blender/source/blender/src/buttons_object.c	2008-02-05 15:09:48 UTC (rev 13576)
@@ -3251,7 +3251,7 @@
 {
 	Object *ob = ob_v;
 	ModifierData *md = modifiers_findByType ( ob, eModifierType_Collision );
-
+	
 	if ( !md )
 	{
 		md = modifier_new ( eModifierType_Collision );
@@ -5134,10 +5134,10 @@
 	}
 	else	
 	{
-	but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Cloth",	10,200,130,20, &val, 0, 0, 0, 0, "Sets object to become cloth");
+		but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Cloth",	10,200,130,20, &val, 0, 0, 0, 0, "Sets object to become cloth");
+		uiButSetFunc(but, object_cloth__enabletoggle, ob, NULL);
 	}
 
-	uiButSetFunc(but, object_cloth__enabletoggle, ob, NULL);
 	uiDefBut(block, LABEL, 0, "",10,10,300,0, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
 	
 	if(clmd)





More information about the Bf-blender-cvs mailing list