I have run into a problem. What I want to do is to make a copy of an animation to have stored in memory, so that I can delete individual bones animations. I use destroyNodeTrack to do this.
However, then I want at a later time to revert and use the original animation. Therefor I want this one saved so I can restore it.
Is there any way to make a copy of an animation with a new name and to revert to that one?
Unworking try code:
Code: Select all
Ogre::SkeletonInstance* skel = entity->getSkeleton();
Ogre::Animation* a = skel->getAnimation("idle");
Ogre::Animation* a2 = skel->getAnimation("open_mouth");
// create animation a2.
if( entity->hasSkeleton() ) {
LogManager::getSingleton().logMessage("Copying Animation : ");
Ogre::Skeleton::BoneIterator it = entity->getSkeleton()->getBoneIterator();
while( it.hasMoreElements() ) {
Ogre::Bone* bone = it.getNext();
a2->createNodeTrack(bone->getHandle());
a2->getNodeTrack(bone->getHandle()) = a->getNodeTrack(bone->getHandle());
}
}