Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Genrich <daniel.genrich@gmx.net>2008-02-05 18:09:48 +0300
committerDaniel Genrich <daniel.genrich@gmx.net>2008-02-05 18:09:48 +0300
commita8c25e279d2209665cf7f561c4cb32837dc83aa3 (patch)
tree4f19960e18dceebe0066f1d4e5fb6f308140153c
parent7a70e5c0c0eacda814ffc32035a649a88b5326d0 (diff)
Cloth: Fix for crash with meshes with no faces, 2. Fix for crash on switching from to another mesh
-rw-r--r--source/blender/blenkernel/intern/cloth.c5
-rw-r--r--source/blender/blenkernel/intern/collision.c4
-rw-r--r--source/blender/src/buttons_object.c6
3 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index e27df5b1ba1..5d0601959cc 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -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 @@ BVH *bvh_build_from_cloth (ClothModifierData *clmd, float epsilon)
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)
{
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 788f5adc922..4ce0cc79502 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -101,6 +101,10 @@ BVH *bvh_build_from_mvert (MFace *mfaces, unsigned int numfaces, MVert *x, unsig
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;
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 2f2c21ae143..ce93a07e843 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -3251,7 +3251,7 @@ static void object_collision__enabletoggle ( void *ob_v, void *arg2 )
{
Object *ob = ob_v;
ModifierData *md = modifiers_findByType ( ob, eModifierType_Collision );
-
+
if ( !md )
{
md = modifier_new ( eModifierType_Collision );
@@ -5134,10 +5134,10 @@ static void object_panel_cloth(Object *ob)
}
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)