Making a copy of an animation

Problems building or running the engine, queries about how to use features etc.
Post Reply
Ieet
Greenskin
Posts: 114
Joined: Wed Feb 21, 2007 12:45 pm
Location: Hellworld

Making a copy of an animation

Post by Ieet »

Hi all,

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());
			}
	}
Thank you in advance.
Ieet
Greenskin
Posts: 114
Joined: Wed Feb 21, 2007 12:45 pm
Location: Hellworld

I guess there is no easy way to do it.

Post by Ieet »

I guess there is no easy way to do it??
Post Reply