From ca17cdc1f99af6ac03899c82bd7a6073a203fe74 Mon Sep 17 00:00:00 2001 From: Julian Knodt Date: Sun, 1 Dec 2024 12:21:08 -0800 Subject: [PATCH] Do not create GLTF Mesh if no faces (#5878) Previously GLTF meshes were created even if there were no faces, which lead to GLTFs which were not technically valid. I believe this fixes the problem I was encountering, but I've not been able to test it because of some Mac compile errors. Will test on a windows machine at some point. Fixes #5868 Co-authored-by: Kim Kulling --- code/AssetLib/glTF2/glTF2Exporter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 3df9d5dda..c3882290b 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -61,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include using namespace rapidjson; @@ -1177,6 +1178,9 @@ void glTF2Exporter::ExportMeshes() { for (unsigned int idx_mesh = 0; idx_mesh < mScene->mNumMeshes; ++idx_mesh) { const aiMesh *aim = mScene->mMeshes[idx_mesh]; + if (aim->mNumFaces == 0) { + continue; + } std::string name = aim->mName.C_Str();