This example shows how to load a ColladaDocument from a file on disk:
ColladaDocument collada = new ColladaDocument(Filename);
Once the ColladaDocument is loaded into RAM, you simply access the member functions and properties from the ColladaDocument. How you interact with the class depends greatly on what you want to do with the data. When you are finished manipulating the data, simply save the file back out to disk.
Here are some simple code samples that might help you see how you traverse through the collada file.
This example shows code that traverses through a loaded ColladaDocument checking for quads:
protected bool ContainsQuads(ColladaDocument document)
{
foreach (Geometry geometry in document.Geometries)
{
foreach (Mesh mesh in geometry.Meshes)
{
foreach (Primitive primitive in mesh.Primitives)
{
if (primitive is Polygons ||
primitive is Polylist)
{
foreach (Polygon polygon in primitive.Polygons)
{
if (polygon.Vertices.Count > 3)
{
return true;
}
}
}
}
}
}
return false;
}
This example shows code that counts the number of skeletons in a loaded ColladaDocument:
protected int GetSkeletonCount(ColladaDocument document)
{
int skeletonCount = 0;
if (document.VisualScenes.Count > 0)
{
foreach (Node node in document.VisualScenes[0].Nodes[0].Nodes)
{
if (node.IsSkeleton)
{
skeletonCount++;
}
}
}
return skeletonCount;
}