Skip to main content

Sometimes we need to load '.skeleton' files just like "open file" from any local path.

The following code snippet shows to accomplish that:

Copy to clipboard
std::ifstream file (path.c_str(), ifstream::in | ifstream::binary); if (!file) OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,"File " + path + " not found.", "OgreSkeletonLoaded"); Ogre::DataStreamPtr stream (OGRE_NEW Ogre::FileStreamDataStream (&file, false)); Ogre::SkeletonPtr myskeleton = Ogre::SkeletonManager::getSingleton().create ("myskeleton", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); Ogre::SkeletonSerializer serializer; serializer.importSkeleton(stream, myskeleton.get());