Merge pull request #2613 from cpetry/master

#2612 - Empty primitive meshes
This commit is contained in:
ousttrue
2025-03-18 14:54:25 +09:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@@ -310,9 +310,6 @@ namespace UniGLTF
{
var node = data.GLTF.nodes[channel.target.node];
var mesh = data.GLTF.meshes[node.mesh];
var primitive = mesh.primitives.FirstOrDefault();
var targets = primitive.targets;
if (!gltf_mesh_extras_targetNames.TryGet(mesh, out List<string> targetNames))
{
throw new UniGLTFNotSupportedException("glTF BlendShape Animation. targetNames invalid.");

View File

@@ -78,6 +78,10 @@ namespace UniGLTF
{
return false;
}
if (Mesh.triangles.Length == 0)
{
return false;
}
if (Materials == null)
{
return false;

View File

@@ -273,6 +273,12 @@ namespace UniGLTF
? MeshExporter_DividedVertexBuffer.Export(_data, unityMesh, Materials, m_settings.InverseAxis.Create(), m_settings)
: MeshExporter_SharedVertexBuffer.Export(_data, unityMesh, Materials, m_settings.InverseAxis.Create(), m_settings)
;
if (gltfMesh.primitives == null || gltfMesh.primitives.Count == 0)
{
Debug.LogError($"gltfMesh.primitives is empty: {unityMesh.Mesh.name}");
}
_gltf.meshes.Add(gltfMesh);
Meshes.Add(unityMesh.Mesh);
if (!MeshBlendShapeIndexMap.ContainsKey(unityMesh.Mesh))