Merge pull request #2214 from tsgcpp/feature/ignore_invalid_mesh_indices

VRM0.xでMeshAnnotationsのmeshに-1が指定されていると一人称メッシュ作成時にNotImplementedExceptionが発生する問題を回避する
This commit is contained in:
ousttrue 2024-01-09 14:01:33 +09:00 committed by GitHub
commit 2c55dc9db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,10 @@ namespace UniVRM10
if (meshAnnotationJsonNode.TryGet(key, out var meshIndexJsonNode))
{
var meshIndex = meshIndexJsonNode.GetInt32();
if (meshIndex < 0)
{
return default;
}
// NOTE: VRM 1.0 では glTF の Node Index を記録するため、それに変換する.
// TODO: mesh が共有されたノードの場合はどうなる? 0x の場合はどうなっていたかを調べて挙動を追従する.