Merge pull request #378 from neon-izm/feature/export_check_dupicate_bone_names

Check bone names duplicate when export vrm file.
This commit is contained in:
hiroj 2020-02-21 21:30:51 +09:00 committed by GitHub
commit 5bfc57564e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,12 @@ namespace VRM
{
yield return "Animator.avatar is not humanoid. Please change model's AnimationType to humanoid. ";
}
if (DuplicateBoneNameExists())
{
yield return "Find duplicate Bone names. Please check model's bone names. ";
}
if (string.IsNullOrEmpty(Title))
{
yield return "Require Title. ";
@ -402,6 +407,18 @@ namespace VRM
AssetDatabase.ImportAsset(path.ToUnityRelativePath());
}
}
//ここで重複ボーン名のチェックをする
bool DuplicateBoneNameExists()
{
var bones = Source.transform.Traverse().ToArray();
var duplicates = bones
.GroupBy(p => p.name)
.Where(g => g.Count() > 1)
.Select(g => g.Key);
return (duplicates.Any());
}
#endif
}
}