From 7480dea1a9956a11430a8816de1b42305a29a2b3 Mon Sep 17 00:00:00 2001 From: yourarcade Date: Sat, 8 Oct 2016 19:18:50 -0700 Subject: [PATCH 1/2] breakShape() - remove parts created with invalid object box along with empty parts. --- Engine/source/ts/tsPartInstance.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Engine/source/ts/tsPartInstance.cpp b/Engine/source/ts/tsPartInstance.cpp index 0c1a1b35c..df97c25db 100644 --- a/Engine/source/ts/tsPartInstance.cpp +++ b/Engine/source/ts/tsPartInstance.cpp @@ -107,10 +107,16 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, VectormMeshObjects.size()) + if (partList[i]->mMeshObjects.size()){ partList[i]->updateBounds(); - else - { + // Remove any parts parts with invalid box + Box3F box = partList[i]->getBounds(); + if(!box.isValidBox() ){ + Con::warnf("TSPartInstance::breakShape - part created with invalid object box. Removing from list."); + partList.erase(i); + i--; + } + }else{ partList.erase(i); i--; } From d0f9aca8591ef0b77349ef7d3522288e46d5bb47 Mon Sep 17 00:00:00 2001 From: Lukas Aldershaab Date: Sat, 3 Oct 2020 23:53:42 +0200 Subject: [PATCH 2/2] Code style improvement --- Engine/source/ts/tsPartInstance.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Engine/source/ts/tsPartInstance.cpp b/Engine/source/ts/tsPartInstance.cpp index df97c25db..6c963c14c 100644 --- a/Engine/source/ts/tsPartInstance.cpp +++ b/Engine/source/ts/tsPartInstance.cpp @@ -107,19 +107,23 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, VectormMeshObjects.size()){ + if (partList[i]->mMeshObjects.size()) + { partList[i]->updateBounds(); // Remove any parts parts with invalid box Box3F box = partList[i]->getBounds(); - if(!box.isValidBox() ){ + if (!box.isValidBox()) + { Con::warnf("TSPartInstance::breakShape - part created with invalid object box. Removing from list."); partList.erase(i); i--; } - }else{ - partList.erase(i); - i--; - } + } + else + { + partList.erase(i); + i--; + } } }