|
|
@@ -1,14 +1,26 @@
|
|
|
-"""instantiate global ShowBase object"""
|
|
|
+"""This module serves as a container to hold the global ShowBase instance, as
|
|
|
+an alternative to using the builtin scope.
|
|
|
+
|
|
|
+Note that you cannot directly import `base` from this module since ShowBase
|
|
|
+may not have been created yet; instead, ShowBase dynamically adds itself to
|
|
|
+this module's scope when instantiated."""
|
|
|
|
|
|
__all__ = []
|
|
|
|
|
|
-from .ShowBase import *
|
|
|
+from .ShowBase import ShowBase, WindowControls
|
|
|
+from direct.directnotify.DirectNotifyGlobal import directNotify, giveNotify
|
|
|
+from panda3d.core import VirtualFileSystem, Notify, ClockObject, PandaSystem
|
|
|
+from panda3d.core import ConfigPageManager, ConfigVariableManager
|
|
|
+from panda3d.direct import get_config_showbase
|
|
|
+
|
|
|
+config = get_config_showbase()
|
|
|
|
|
|
-# Create the showbase instance
|
|
|
-# This should be created by the game specific "start" file
|
|
|
-#ShowBase()
|
|
|
-# Instead of creating a show base, assert that one has already been created
|
|
|
-assert base
|
|
|
+vfs = VirtualFileSystem.getGlobalPtr()
|
|
|
+ostream = Notify.out()
|
|
|
+globalClock = ClockObject.getGlobalClock()
|
|
|
+cpMgr = ConfigPageManager.getGlobalPtr()
|
|
|
+cvMgr = ConfigVariableManager.getGlobalPtr()
|
|
|
+pandaSystem = PandaSystem.getGlobalPtr()
|
|
|
|
|
|
# Set direct notify categories now that we have config
|
|
|
directNotify.setDconfigLevels()
|
|
|
@@ -31,3 +43,4 @@ builtins.inspect = inspect
|
|
|
if (not __debug__) and __dev__:
|
|
|
notify = directNotify.newCategory('ShowBaseGlobal')
|
|
|
notify.error("You must set 'want-dev' to false in non-debug mode.")
|
|
|
+ del notify
|