protected void ApplyTemplate()
{
Undo.RegisterCompleteObjectUndo(this, "Apply Template");
HumanTemplate humanTemplate = this.OpenHumanTemplate();
if (humanTemplate == null)
{
return;
}
for (int i = 0; i < this.m_Bones.Length; i++)
{
string boneName = humanTemplate.Find(this.m_Bones[i].humanBoneName);
if (boneName.Length > 0)
{
Transform bone = base.modelBones.Keys.FirstOrDefault((Transform f) => AvatarMappingEditor.MatchName(f.name, boneName));
this.m_Bones[i].bone = bone;
}
else
{
this.m_Bones[i].bone = null;
}
this.m_Bones[i].Serialize(base.serializedObject);
}
this.ValidateMapping();
SceneView.RepaintAll();
}