Problem with animation using actors, help plz

The problem is explained in the code
The code is self explanatory
please download all the files here
mediafire.com/?kkofvenouh2vaof

And please save my life!

#!/usr/bin/env python
#simpel program, loads a huge castle like structure, loads a camera that flies around, and loads a simple animation of a cube moving around, thats it
#loading into the actor, a non-animated cube, and an animated cube
#the way i created the objects is as follows
#created a cube, created a bone, attached bone to cube, used the pose mode, animated the bone, exported the cube twice
#once with Animation set to None(cubaNA.x), and another time with animation set to Full animation (cubaA.x)
#then i converted each into an egg file using x2egg -o "cubeNA.egg" "cubaNA.x"
#[edit] please note that both work as intended in pview

#The Error is 

#D:\komodo trials\Secondary\Python>ppython neptune-castle.py
#DirectStart: Starting the game.
#Known pipe types:
#  wglGraphicsPipe
#(all display modules loaded.)
#:Actor(warning): cubeNA is not a character!
#
#D:\komodo trials\Secondary\Python>ppython neptune-castle.py
#DirectStart: Starting the game.
#Known pipe types:
#  wglGraphicsPipe
#(all display modules loaded.)
#:Actor(warning): cubeNA is not a character!
#Traceback (most recent call last):
#  File "neptune-castle.py", line 115, in <module>
#    w=World ()
#  File "neptune-castle.py", line 71, in __init__
#    self.Nano.loop("run")     #here is the whole problem
#  File "C:\Panda3D-1.7.2\direct\actor\Actor.py", line 1555, in loop
#    for control in self.getAnimControls(animName, partName):
#  File "C:\Panda3D-1.7.2\direct\actor\Actor.py", line 1849, in getAnimControls
#    allowAsyncBind = allowAsyncBind)
#  File "C:\Panda3D-1.7.2\direct\actor\Actor.py", line 2341, in __bindAnimToPart
#    bundle = self.__commonBundleHandles[subpartDef.truePartName].getBundle()
#KeyError: 'modelRoot'
#
#D:\komodo trials\Secondary\Python>






from pandac.PandaModules import CollisionHandlerFloor, CollisionNode, CollisionTraverser, BitMask32, CollisionRay
from pandac.PandaModules import loadPrcFileData
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from direct.actor import Actor
from random import random
from math import sin, cos, pi
from panda3d.core import NodePath
from direct.task import Task
import sys
class World(DirectObject):
    def __init__(self):
        #init
        self.gameTask = taskMgr.add(self.Move_it, "Move_it")
        #variables Just to control the camera
        self.dist = 15  
        self.Rot = 0
        self.last = 0
        self.DEG_TO_RAD = pi/180
       
        #cam
        base.disableMouse()                 #disable mouse control of the camera

        
        #keys for controlling the camera

        self.accept("escape", sys.exit)  
        self.keys = {"turnLeft" : 0, "turnRight": 0,"accel": 0,"decel": 0,"asc":0,"dec":0,"rotL":0,"rotR":0}
        self.accept("arrow_left",     self.setKey, ["turnLeft", 1])
        self.accept("arrow_left-up",  self.setKey, ["turnLeft", 0])
        self.accept("arrow_right",    self.setKey, ["turnRight", 1])
        self.accept("arrow_right-up", self.setKey, ["turnRight", 0])
        self.accept("arrow_up",       self.setKey, ["accel", 1])
        self.accept("arrow_up-up",    self.setKey, ["accel", 0])
        self.accept("arrow_down",       self.setKey, ["decel", 1])
        self.accept("arrow_down-up",    self.setKey, ["decel", 0])
        self.accept("e",       self.setKey, ["asc", 1])
        self.accept("e-up",    self.setKey, ["asc", 0])
        self.accept("q",       self.setKey, ["dec", 1])
        self.accept("q-up",    self.setKey, ["dec", 0])
        self.accept("a",    self.setKey, ["rotL", 1])
        self.accept("a-up",    self.setKey, ["rotL", 0])
        self.accept("d",    self.setKey, ["rotR", 1])
        self.accept("d-up",    self.setKey, ["rotR", 0])
        
        #terrain no problems here
        self.terrain = loader.loadModel("castle4")
        self.terrain.reparentTo(render)
        self.terrain.setScale(1)
        self.start = self.terrain.find("**/start_point").getPos()
        self.X = self.start.getX()
        self.Y = self.start.getY()
        self.Z = self.start.getZ()
        camera.setPos(self.start)
        
	#character here is the problem
        
        #cubeNA is a cube not animated, and cubaA is animated, both do what is expected in pview
        self.Nano  = Actor.Actor("cubeNA",{"run":"cubaA"}) 
        self.Nano.reparentTo(render)
        self.Nano.setScale(1)
        self.Nano.setPos(self.start) # no problem here, it works well at placing the camera
        #self.Nano.loop("run")     #here is the whole problem
        #I placed it here, and in the Move_it task, same error occurs
        
        
        #movement
    def setKey(self, key, val): self.keys[key] = val
    def Move_it(self,Task):      
        self.Rot = self.Rot%360
        self.heading_rad = self.DEG_TO_RAD * self.Rot    
        if self.keys["turnLeft"]: 
            self.X =self.X -self.dist
            camera.setX(self.X)
        
        if self.keys["turnRight"]:
            self.X =self.X +self.dist
            camera.setX(self.X )
        
        if self.keys["accel"]:
            self.Y =self.Y +self.dist
            camera.setY(self.Y)
            camera.setX(self.X)
            
        if self.keys["decel"]:
            self.Y =self.Y -self.dist
            camera.setY(self.Y)
            camera.setX(self.X)
    
        if self.keys["asc"]:
            self.Z =self.Z +self.dist
            camera.setZ(self.Z )
    
        if self.keys["dec"]:
            self.Z =self.Z -self.dist
            camera.setZ(self.Z )
        
        if self.keys["rotL"]:
            self.Rot= self.Rot + self.dist/15
            camera.setH(self.Rot)
            
        if self.keys["rotR"]:
            self.Rot= self.Rot - self.dist/15
            camera.setH(self.Rot)

        return Task.cont
w=World ()
run()

4 days now, no reply :S

The cubeNA egg file does not have the { 1 } flag in it, so it is not recognized as a character, it is only loaded as plain geometry.
Try exporting cubeNA with the full animation setting, but don’t actually have any animation keys on it.

Thanks a lot man! It worked, I removed the animation frames and reexported it, it worked!

I really appreciate your help, you are a life saver, although the animation isnt visible, but now I am 1 step ahead :smiley:

you cant imagine how thankful I am :slight_smile: