History: Loading skeletons from any path
Source of version: 1 (current)
Copy to clipboard
Sometimes we need to load '.skeleton' files just like "open file" from any local path.
The following code snippet shows to accomplish that:
{CODE(wrap="1", colors="c++")}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());{CODE}