Skeleton* AssimpAssetLoader::createSkeleton(const aiNode &node)
	{
		Skeleton *skel = NULL;

		mBones.clear();
		aggregateBones(node);
		if(mBones.size() !=  0)
		{
			aiNode *skeletonRootNode = findSkeletonRoot(node);
			skel = new Skeleton(AssimpHelpers::aiNodeToBone(skeletonRootNode));

			buildSkeletonFromSubTree(skel->getRoot(), skeletonRootNode);
			std::cout << "found " << mBones.size() << " bones" << std::endl; 
			std::cout << "Skeleton Root Node: " << skeletonRootNode->mName.C_Str()  << std::endl;

			skel->getRoot()->debugPrintTree();
		}

		return skel;
	}
//-----------------------------------------------------------------------------
//! Populates nameToNode, nameToBone, jointGroups, skinnedMeshes
void SLAssimpImporter::performInitialScan(const aiScene* scene)
{
    // populate the _nameToNode map and print the assimp structure on detailed log verbosity.
    logMessage(LV_detailed, "[Assimp scene]\n");
    logMessage(LV_detailed, "  Cameras: %d\n", scene->mNumCameras);
    logMessage(LV_detailed, "  Lights: %d\n", scene->mNumLights);
    logMessage(LV_detailed, "  Meshes: %d\n", scene->mNumMeshes);
    logMessage(LV_detailed, "  Materials: %d\n", scene->mNumMaterials);
    logMessage(LV_detailed, "  Textures: %d\n", scene->mNumTextures);
    logMessage(LV_detailed, "  Animations: %d\n", scene->mNumAnimations);
    
    logMessage(LV_detailed, "---------------------------------------------\n");
    logMessage(LV_detailed, "  Node node tree: \n");
    findNodes(scene->mRootNode, "  ", true);
    
    logMessage(LV_detailed, "---------------------------------------------\n");
    logMessage(LV_detailed, "   Searching for skinned meshes and scanning joint names.\n");


    findJoints(scene);
    findSkeletonRoot();
}