gr8tact
16-04-2007 08:32:37
I wrote like this:
and... an exception raised
In C++, 'Ogre::Animation::clone(...)' works well
So I rewrite first code like this. works well.
And... I think this is python-ogre's bug. Right?
plz review about this
best regards!
def cloneAnimation( entity, srcName, destName ):
skel = entity.getSkeleton()
srcAnim = skel.getAnimation( srcName )
srcAnim.clone( destName )
and... an exception raised
srcAnim.clone( destName )
OgreItemIdentityException: OGRE EXCEPTION(4:): Node track with the specified handle 0 already exists in Animation::createNodeTrack at \Development\ogrenew\OgreMain\src\OgreAnimation.cpp (line 73)
In C++, 'Ogre::Animation::clone(...)' works well

So I rewrite first code like this. works well.
def cloneAnimation( entity, srcName, destName ):
skel = entity.getSkeleton()
srcAnim = skel.getAnimation( srcName )
newAnim = skel.createAnimation( destName, srcAnim.getLength() )
for i in xrange( srcAnim.getNumNodeTracks() ):
nt = srcAnim.getNodeTrack(i)
newNT = newAnim.createNodeTrack( nt.getHandle(), nt.getAssociatedNode() )
for j in xrange( nt.getNumKeyFrames() ):
kf = nt.getNodeKeyFrame(j)
newKF = newNT.createNodeKeyFrame( kf.getTime() )
newKF.setTranslate( kf.getTranslate() )
newKF.setScale( kf.getScale() )
newKF.setRotation( kf.getRotation() )
skel._refreshAnimationState( entity.getAllAnimationStates() )
And... I think this is python-ogre's bug. Right?

best regards!