Cloth: Fix for crash with meshes with no faces, 2. Fix for crash on switching from to another mesh
This commit is contained in:
@@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_arithb.h"
|
#include "BLI_arithb.h"
|
||||||
|
#include "BLI_editVert.h"
|
||||||
#include "BLI_edgehash.h"
|
#include "BLI_edgehash.h"
|
||||||
#include "BLI_linklist.h"
|
#include "BLI_linklist.h"
|
||||||
|
|
||||||
@@ -203,6 +204,10 @@ BVH *bvh_build_from_cloth (ClothModifierData *clmd, float epsilon)
|
|||||||
|
|
||||||
verts = cloth->verts;
|
verts = cloth->verts;
|
||||||
|
|
||||||
|
// in the moment, return zero if no faces there
|
||||||
|
if(!cloth->numfaces)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
bvh = MEM_callocN(sizeof(BVH), "BVH");
|
bvh = MEM_callocN(sizeof(BVH), "BVH");
|
||||||
if (bvh == NULL)
|
if (bvh == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ BVH *bvh_build_from_mvert (MFace *mfaces, unsigned int numfaces, MVert *x, unsig
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in the moment, return zero if no faces there
|
||||||
|
if(!numfaces)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
bvh->flags = 0;
|
bvh->flags = 0;
|
||||||
bvh->leaf_tree = NULL;
|
bvh->leaf_tree = NULL;
|
||||||
bvh->leaf_root = NULL;
|
bvh->leaf_root = NULL;
|
||||||
|
|||||||
@@ -3251,7 +3251,7 @@ static void object_collision__enabletoggle ( void *ob_v, void *arg2 )
|
|||||||
{
|
{
|
||||||
Object *ob = ob_v;
|
Object *ob = ob_v;
|
||||||
ModifierData *md = modifiers_findByType ( ob, eModifierType_Collision );
|
ModifierData *md = modifiers_findByType ( ob, eModifierType_Collision );
|
||||||
|
|
||||||
if ( !md )
|
if ( !md )
|
||||||
{
|
{
|
||||||
md = modifier_new ( eModifierType_Collision );
|
md = modifier_new ( eModifierType_Collision );
|
||||||
@@ -5134,10 +5134,10 @@ static void object_panel_cloth(Object *ob)
|
|||||||
}
|
}
|
||||||
else
|
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*/
|
uiDefBut(block, LABEL, 0, "",10,10,300,0, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
|
||||||
|
|
||||||
if(clmd)
|
if(clmd)
|
||||||
|
|||||||
Reference in New Issue
Block a user