Custom Modules

I tried creating my own class module, which seems to be loading up just fine, however, when trying to assign an Actor to one of the class’s variables I get an error…

Traceback (most recent call last):
  File "", line 4, in <module>
    testChar = dActor(Actor.Actor("models/panda-model", {"walk":"models/panda-walk4"}))
  File "C:\Panda3D-1.5.4\direct\src\actor\", line 175, in __init__
    self.mergeLODBundles = base.config.GetBool('merge-lod-bundles', 1)
NameError: global name 'base' is not defined

dActor is just a test class I made that stores values, nothing else, I’m just trying to figure out how to do things.
from pandac.PandaModules import Point3
class dActor:
    testPos = Point3(0,0,0)
    def __init__(self,theActor):
        self.model = theActor;
    def getPos(self)
        return self.testPos
from testClass.dActor import dActor
from import Actor

testChar = dActor(Actor.Actor("models/panda-model", {"walk":"models/panda-walk4"}))
print testChar.getPos()

Any ideas as to what is happening?


You forgot to put a DirectStart import line in
Creating an Actor requires a ShowBase to have been created (and DirectStart does that for you).

ah, well i’m retarded, always the little things.

Thanks, heh.