hi there,
i have created a model in maya with several animtions which all of them i saved as a different maya file.
i exported the model as an “Actor” and then every animation as “Animation”.
I loaded my model into Panda and depending on the button I press a different animaion should play.
Unfortunatelly it does’t work, the animtion doesn’t play. I don’t know if my code is wrong or my exported files.
Here is my code:
# -*- coding: utf-8 -*-
import direct.directbase.DirectStart
from pandac.PandaModules import CollisionTraverser,CollisionNode
from pandac.PandaModules import CollisionHandlerQueue,CollisionRay
from pandac.PandaModules import Filename
from pandac.PandaModules import PandaNode,NodePath,Camera,TextNode
from pandac.PandaModules import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.task.Task import Task
from direct.showbase.DirectObject import DirectObject
import random, sys, os, math
class World(DirectObject):
def __init__(self):
base.setBackgroundColor(.8,.8,.8)
#light1 = render.attachNewNode (PointLight("light1"))
#self.render.setLight(light1)
#self.light1.setPos(0,-50,20)
base.cam.setPos(0,-50,10)
self.machine = Actor ("models/count_model", {
"0":"models/count_00_anim",
"1":"models/count_01_anim",
"2":"models/count_02_anim",
"3":"models/count_03_anim",
"4":"models/count_04_anim",
"5":"models/count_05_anim",
"6":"models/count_06_anim",
"7":"models/count_07_anim",
"8":"models/count_08_anim",
"9":"models/count_09_anim"})
self.machine.reparentTo(render)
self.machine.setScale(.5)
#self.accept("escape", sys.exit)#exit on esc
self.accept("0", self.machine.play, ["0"])
self.accept("1", self.machine.play, ["1"])
self.accept("2", self.machine.play, ["2"])
self.accept("3", self.machine.play, ["3"])
self.accept("4", self.machine.play, ["4"])
self.accept("5", self.machine.play, ["5"])
self.accept("6", self.machine.play, ["6"])
self.accept("7", self.machine.play, ["7"])
self.accept("a", self.machine.play, ["8"])
self.accept("9", self.machine.play, ["9"])
w=World()
run()