From 94e8f15a245a4f9805dbbfdd1d4e5f209440cd96 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Wed, 27 Oct 2021 10:04:50 +0200 Subject: [PATCH] Check if the model is empty based on the node hierarchy. --- source/model/modelutils.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/model/modelutils.js b/source/model/modelutils.js index 6cce100..688d3c5 100644 --- a/source/model/modelutils.js +++ b/source/model/modelutils.js @@ -47,13 +47,13 @@ OV.FlipMeshTrianglesOrientation = function (mesh) OV.IsModelEmpty = function (model) { - for (let i = 0; i < model.MeshCount (); i++) { - let mesh = model.GetMesh (i); - if (mesh.TriangleCount () > 0) { - return false; + let isEmpty = true; + model.EnumerateMeshInstances ((meshInstance) => { + if (meshInstance.TriangleCount () > 0) { + isEmpty = false; } - } - return true; + }); + return isEmpty; }; OV.CloneMesh = function (mesh)