Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check bone names duplicate when export vrm file. #378

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ public IEnumerable<string> CanExport()
{
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. ";
Expand Down Expand Up @@ -402,6 +407,18 @@ void Export(string path, List<GameObject> destroy)
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
}
}