Hello. I’m developing my application and I’m trying to resolve an animation loading problem. Take a look at the screen:
jasonuniversetest.appspot.com/fi … xpaxix5wIM
Sorry for Polish names for the buttons but the application will be Polish.
The problem is related to animation loading. When I click the button, which should start the selected animation, the animation starts after small period of time and not from the first frame. And it’s only happens for the first time I click the button. The further clicks on the same animation-button are running smoothly. As if the animation is being processed during the first use.
That’s how I’m loading model and animations:
self.noddy = Actor()
And for example that is the action of the button:
Sequence(self.noddy.actorInterval("krecenie_glowa",playRate = 2.0), Func(self.unlock),name="jump").start()
Function unlock sets one variable to allow another animations to start.
Please help me. Is there any method to force animations to be processed before use?
really sounds like that egg/bam thing.
Basically the first time you load a 3d file its cached, the cache folder depends on your OS. So the next time you load the same model it will be faster. Actually the cache folder isnt cleared when you even restart the application.
Its not like panda makes a copy of the egg file in the cache folder, it also converts it to bam file, which is a binary file and loads faster than an egg, which is a text file.
So you can just convert them to bam in the first place.
It may not be entirely egg loading–when you load an an animation the first time, Panda has to bind the animation to all of your joints, which can take a largish fraction of a second.
You can avoid this by calling Actor.bindAnim(‘krok_1’) to preload a particular animation file, or Actor.bindAllAnims() to preload all animation files.
You can also avoid this to a certain extent by using threaded animation binding. This means there will not be a hitch in the rendering, but your animation still won’t play immediately the first time you play it. Instead, the actor will hold his last pose until the animation finishes loading in the background. You have to go only a little bit out of your way to use threaded animation binding, though it doesn’t sound like it’s what you want, from your description.
Now everything works great Thanks a lot.
At first I used Anon’s solution and it worked fine. Now my application uses both solutions to be sure . Thanks a lot guys