From 23dccfadf034d9fdc0de451a4fd8a8f9d160f4b0 Mon Sep 17 00:00:00 2001 From: Daniel Stokes Date: Fri, 19 Jul 2013 22:11:26 +0000 Subject: Bge fix [#33016] Blender crashes when I start the game engine Caused by a bit of a disconnect from the BGE mesh and BMesh. --- .../Physics/Bullet/CcdPhysicsController.cpp | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsController.cpp') diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index b389347cdb0..0604157a420 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -1587,6 +1587,21 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, if (mf->v4 && vert_tag_array[mf->v4] == false) {vert_tag_array[mf->v4] = true; tot_bt_verts++;} } } + + /* Can happen with ngons */ + if (!tot_bt_verts) { + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + dm = NULL; + } + return false; + } m_vertexArray.resize(tot_bt_verts*3); @@ -1662,6 +1677,21 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, } } + /* Can happen with ngons */ + if (!tot_bt_verts) { + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + dm = NULL; + } + return false; + } + m_vertexArray.resize(tot_bt_verts*3); m_polygonIndexArray.resize(tot_bt_tris); m_triFaceArray.resize(tot_bt_tris*3); -- cgit v1.2.3