Fixed bug

This commit is contained in:
Perfare 2018-12-18 09:59:48 +08:00
parent 5cd4cf67cf
commit 761579ab1a

View File

@ -397,25 +397,14 @@ namespace AssetStudio
bone.Name = m_GameObject.m_Name; bone.Name = m_GameObject.m_Name;
} }
} }
if (string.IsNullOrEmpty(bone.Name)) if (!string.IsNullOrEmpty(bone.Name))
{ {
var boneHash = mesh.m_BoneNameHashes[i];
bone.Name = GetNameFromBonePathHashes(boneHash);
if (string.IsNullOrEmpty(bone.Name))
{
bone.Name = avatar?.FindBoneName(boneHash);
}
if (string.IsNullOrEmpty(bone.Name))
{
//throw new Exception("A Bone could neither be found by hash in Avatar nor by index in SkinnedMeshRenderer.");
continue;
}
}
var convert = Matrix.Scaling(new Vector3(-1, 1, 1)); var convert = Matrix.Scaling(new Vector3(-1, 1, 1));
bone.Matrix = convert * Matrix.Transpose(mesh.m_BindPose[i]) * convert; bone.Matrix = convert * Matrix.Transpose(mesh.m_BindPose[i]) * convert;
iMesh.BoneList.Add(bone); iMesh.BoneList.Add(bone);
} }
} }
}
//Morphs //Morphs
if (mesh.m_Shapes != null) if (mesh.m_Shapes != null)