Morph_animation

saladin

21-08-2007 14:36:25

Hi, I'm trying to test out morphing animation. I copied the .mesh.xml example from http://www.ogre3d.org/wiki/index.php/Morph_animation
and converted it to binary. But when I try to load animation 'morph', python ogre told me 'The entity is not animated'.

Can anyone tell me why this is?

andy

21-08-2007 20:40:14

Could you post the code you are using so we can better see where the error is etc.

Cheers
Andy

saladin

22-08-2007 02:23:23

Could you post the code you are using so we can better see where the error is etc.

Cheers
Andy


Well, the easiest way is to copy the .mesh.xml example from the wiki link above. Convert it to binary using the ogreXMLConverter tool. And try loading it up in a scene. I used Demo_WX to test it.

So in the pycrust shell if I do:
ent = MainFrame.ogreWin.sceneManager.createEntity("morphingTriangle", "morph.mesh")
MainFrame.ogreWin.sceneManager.getRootSceneNode().createChildSceneNode().attachObject(ent)

I will see the triangle. And then we should be able to start the animation by calling:
ent.getAnimationState("morph").setEnabled(True)
And just keep calling addTime() afterwards.

But the message I get from the console says the entitiy is not animated.

dermont

22-08-2007 07:20:03

Works fine here, python-ogre Linux/Ogre1.4.4.

import ogre.renderer.OGRE as ogre
import SampleFramework as SF

class TutorialApplication(SF.Application):
def _createScene(self):
sm = self.sceneManager
sm.ambientLight = ogre.ColourValue(1, 1, 1)
ent1 = sm.createEntity("Ninja", "ninja.mesh")
node1 = sm.rootSceneNode.createChildSceneNode("NinjaNode")
node1.attachObject(ent1)

ent3 = sm.createEntity("Morph", "testmorph.mesh")
node3 = sm.rootSceneNode.createChildSceneNode("TestMorph")
node3.attachObject(ent3)

self.animationStates = []

if ent3.getAllAnimationStates().hasAnimationState("morph"):
##get the animation state
state = ent3.getAnimationState("morph")
state.setEnabled(True)
self.animationStates.append(state)


def _createFrameListener(self):
self.frameListener = MorphAnimationFrameListener(self.renderWindow,
self.camera,
self.animationStates)
self.root.addFrameListener(self.frameListener)

class MorphAnimationFrameListener(SF.FrameListener):
def __init__(self, renderWindow, camera, animationStates):
SF.FrameListener.__init__(self, renderWindow, camera)
self.animationStates = animationStates

def frameStarted(self, frameEvent):
for index in xrange(0,len(self.animationStates)):
self.animationStates[index].addTime(frameEvent.timeSinceLastFrame * 0.15)
return SF.FrameListener.frameStarted(self, frameEvent)
if __name__ == "__main__":
ta = TutorialApplication()
ta.go()

saladin

23-08-2007 22:33:00

Yeah it works...I'm so very very very sorry. I was using an outdated ogreXMLConverter before.

:oops: :oops: :oops: