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 <kimkulling@users.noreply.github.com>
This commit is contained in:
Julian Knodt
2024-12-01 12:21:08 -08:00
committed by GitHub
parent 739ebfd207
commit ca17cdc1f9

View File

@@ -61,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cinttypes>
#include <limits>
#include <memory>
#include <iostream>
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();