How do I import animation?

I just went to the documentation and read about the animation in panda, and i’m little bit confused about the animation node…

nodePath = Actor('Model Path', {
  'Animation Name 1':'Animation Path 1',
  'Animation Name 2':'Animation Path 2',

What are those dictionary stuffs? are those models? do I have to make each model for each frame?

EGG file can contain different things, including animation data and it can be stored separately - one file for the model and another file for the animation data.
‘Model Path’ - your main file, which contain model mesh with joints (bones) structure.
‘Animation Name 1’:‘Animation Path 1’ - arbitrary name of animation to use in Panda later : path to the file with animation, for example ‘walk’.
‘Animation Name 2’:‘Animation Path 2’ - another animation, for example ‘shoot’

I made an animation with armature and I exported it using Yabee exporter but i’m only getting one egg file.

Do I have to export animation files separately? if so, how do I export animation file? … f?raw=true
See options->animation

I did manage to make animation files but now I have a new problem :frowning:

self.animodel = loader.loadModel('resources/modeltest.egg.pz')
    self.AModel = Actor(self.animodel, {'band1':'resources/modeltest_a01.egg.pz'})
    self.AModel.setPos(0, 40, 0)
    self.AModel.setScale(3, 3, 3)
    self.AModelCTR = self.AModel.getAnimControl('ban1')
    self.AModelCTR.loop(restart = 1)
  1. why is ‘self.AModel.loop(‘band1’)’ not working? If I make an AnimControl, it works.

  2. setPos and setScale doesn’t work after AnimControl is created. Do you know how to fix this?

It should work. Perhaps something happens somewhere else in your code. To check it - make clean example with only loading and looping animated model.

import direct.directbase.DirectStart
from import Actor

class Application():
  def __init__(self):
    self.animodel = loader.loadModel('resources/modeltest.egg.pz')
    self.AModel = Actor(self.animodel, {'band1':'resources/modeltest_a01.egg.pz'})
    self.AModel.setPos(0, 40, 0)
    self.AModel.setScale(3, 3, 3)

    #self.AModelCTR = self.AModel.getAnimControl('band1')
    #self.AModelCTR.loop(restart = 1)


If I use getAnimControl, it plays the animation. But the position and the scale doesn’t work.

Ah, I know what happened. Try to use a = Application(). It’s not obvious, but Actor - is high-level Python class, so when you have no links on it, the garbage collector remove it and you loose control. It’s described here … Animations