エラーを警告に落とした。エクスポート時に null check を追加した。

This commit is contained in:
ousttrue
2020-09-15 14:14:03 +09:00
parent c26e3fa169
commit 116169ca66
2 changed files with 10 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ namespace VRM
var key = c.Key;
if (used.Contains(key))
{
yield return Validation.Error($"duplicated BlendShapeKey: {c}");
yield return Validation.Error($"duplicated BlendShapeKey: {key}");
}
else
{
@@ -55,7 +55,7 @@ namespace VRM
var target = p.transform.Find(v.RelativePath);
if (target == null)
{
yield return Validation.Error($"{c}.Values[{i}].RelativePath({v.RelativePath} is not found");
yield return Validation.Warning($"{c}.Values[{i}].RelativePath({v.RelativePath} is not found");
}
}
@@ -64,7 +64,7 @@ namespace VRM
var v = c.MaterialValues[i];
if (!materialNames.Contains(v.MaterialName))
{
yield return Validation.Error($"{c}.MaterialValues[{i}].MaterialName({v.MaterialName} is not found");
yield return Validation.Warning($"{c}.MaterialValues[{i}].MaterialName({v.MaterialName} is not found");
}
}
}

View File

@@ -19,7 +19,12 @@ namespace VRM
public static glTF_VRM_BlendShapeBind Create(Transform root, BlendShapeBinding binding,
gltfExporter exporter)
{
var transform = UniGLTF.UnityExtensions.GetFromPath(root.transform, binding.RelativePath);
var transform = root.transform.Find(binding.RelativePath);
if (transform == null)
{
Debug.LogWarning($"{binding.RelativePath} not found");
return null;
}
var renderer = transform.GetComponent<SkinnedMeshRenderer>();
if (renderer == null)
{
@@ -38,7 +43,7 @@ namespace VRM
return null;
}
if(!exporter.MeshBlendShapeIndexMap.TryGetValue(mesh, out Dictionary<int, int> blendShapeIndexMap))
if (!exporter.MeshBlendShapeIndexMap.TryGetValue(mesh, out Dictionary<int, int> blendShapeIndexMap))
{
// この Mesh は エクスポートされていない
return null;