fix prim.targets.count == prim.extras.targetNames.count check

古いデータで先頭の prim[0] にしか morph のデータを格納してないタイプ #616
This commit is contained in:
ousttrue
2020-11-17 16:08:32 +09:00
parent 4ef5b659f5
commit 04c064aa6e

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -405,16 +405,13 @@ namespace UniGLTF
if (prim.extras != null && prim.extras.targetNames != null)
{
var targetNames = prim.extras.targetNames;
for (int i = 1; i < gltfMesh.primitives.Count; ++i)
for (var i = 0; i < BlendShapes.Count; i++)
{
if (gltfMesh.primitives[i].targets.Count != targetNames.Count)
if (i >= targetNames.Count)
{
throw new FormatException(string.Format("different targets length: {0} with targetNames length.",
gltfMesh.primitives[i]));
Debug.LogWarning($"invalid primitive.extras.targetNames length");
break;
}
}
for (var i = 0; i < targetNames.Count; i++)
{
BlendShapes[i].Name = targetNames[i];
}
}