I’m working on my first project with panda3d.
My app class inherits from ShowBase.
I create a single instance of the app class at the top level.
I do NOT import DirectStart.
My code is presently working (based somewhat on the code from the tutorials), but I don’t understand what this “base” object is.
Will it work if I just replace “base” with my application instance (subclass of ShowBase)?
Also, is there a way to disable creation of the “base” object entirely? It seems like the “base” object is just for toy projects using procedural code and global variables. I want this to be a full-fledged game when I’m finished, so I want to use large-project software engineering techniques (modules and classes). In particular, if a “base” object is created for every module in my project that imports panda, that may impact performance.
At least one other forum post I’ve read (sorry, I lost the link) implies that “base” is created by DirectStart. Again, I am NOT importing DirectStart, but there is still a “base” object.
I think it’s extremely poor practice to dump things in the global namespace in Python. I don’t have any statements of the form “from module import base”, “from module import *”, or any objects called “base” in my code. But panda3d somehow puts a “base” object in the global namespace nonetheless. This is fine for tutorials and class projects, but there should be a way to disable the behavior for larger applications.
Is there a convenient list somewhere of all the things Panda creates in the global namespace without your consent?
How does Panda do that, anyway? I thought the Python programming model required every object to exist inside a module, and only be visible in another module’s namespace with a “from module import…” statement, or directly creating it in my module by assigning to it.