public override void CreateFolderFile(string folder)
{
XDocument doc = new XDocument();
XElement root = new XElement("meshWeights", new XAttribute("count", this.VertexWeights.Count));
doc.Add(root);
root.Add(new XElement("highestBoneIndex", this.HighestBoneIndex));
root.Add(new XElement("highestVertexWeightCount", this.HighestVertexWeightCount));
for (int i = 0; i < this.VertexWeights.Count; ++i)
{
XElement vWeight = new XElement("vertex",
new XAttribute("count", this.VertexWeights[i].BoneIndices.Count));
root.Add(vWeight);
for (int j = 0; j < this.VertexWeights[i].BoneIndices.Count; ++j)
{
vWeight.Add(new XElement("vertexWeight",
new XAttribute("boneIndex", this.VertexWeights[i].BoneIndices[j]),
new XAttribute("weight", this.VertexWeights[i].Weights[j])));
}
}
string fileName = System.IO.Path.Combine(folder, "meshWeights.xml");
using (FileStream stream = System.IO.File.Create(fileName))
{
doc.Save(stream);
}
}