showbase: move run() and __dev__ to ShowBaseGlobal
Also remove ShowBaseGlobal notify category, it doesn't really add anything
This commit is contained in:
parent
89be2c19af
commit
0cf605ce7d
|
|
@ -47,10 +47,6 @@ if __debug__:
|
|||
from . import OnScreenDebug
|
||||
from . import AppRunnerGlobal
|
||||
|
||||
def legacyRun():
|
||||
assert builtins.base.notify.warning("run() is deprecated, use base.run() instead")
|
||||
builtins.base.run()
|
||||
|
||||
@atexit.register
|
||||
def exitfunc():
|
||||
if getattr(builtins, 'base', None) is not None:
|
||||
|
|
@ -369,7 +365,6 @@ class ShowBase(DirectObject.DirectObject):
|
|||
builtins.bboard = self.bboard
|
||||
# Config needs to be defined before ShowBase is constructed
|
||||
#builtins.config = self.config
|
||||
builtins.run = legacyRun
|
||||
builtins.ostream = Notify.out()
|
||||
builtins.directNotify = directNotify
|
||||
builtins.giveNotify = giveNotify
|
||||
|
|
@ -391,7 +386,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||
|
||||
# Now add this instance to the ShowBaseGlobal module scope.
|
||||
from . import ShowBaseGlobal
|
||||
builtins.run = ShowBaseGlobal.run
|
||||
ShowBaseGlobal.base = self
|
||||
ShowBaseGlobal.__dev__ = self.__dev__
|
||||
|
||||
if self.__dev__:
|
||||
ShowBase.notify.debug('__dev__ == %s' % self.__dev__)
|
||||
|
|
@ -515,6 +512,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||
|
||||
# Remove the built-in base reference
|
||||
if getattr(builtins, 'base', None) is self:
|
||||
del builtins.run
|
||||
del builtins.base
|
||||
del builtins.loader
|
||||
del builtins.taskMgr
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from panda3d.core import ConfigPageManager, ConfigVariableManager
|
|||
from panda3d.direct import get_config_showbase
|
||||
|
||||
config = get_config_showbase()
|
||||
__dev__ = config.GetBool('want-dev', __debug__)
|
||||
|
||||
vfs = VirtualFileSystem.getGlobalPtr()
|
||||
ostream = Notify.out()
|
||||
|
|
@ -25,6 +26,10 @@ pandaSystem = PandaSystem.getGlobalPtr()
|
|||
# Set direct notify categories now that we have config
|
||||
directNotify.setDconfigLevels()
|
||||
|
||||
def run():
|
||||
assert ShowBase.notify.warning("run() is deprecated, use base.run() instead")
|
||||
base.run()
|
||||
|
||||
def inspect(anObject):
|
||||
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||
# it up as a dependency when building a .p3d package.
|
||||
|
|
@ -41,6 +46,4 @@ builtins.inspect = inspect
|
|||
|
||||
# this also appears in AIBaseGlobal
|
||||
if (not __debug__) and __dev__:
|
||||
notify = directNotify.newCategory('ShowBaseGlobal')
|
||||
notify.error("You must set 'want-dev' to false in non-debug mode.")
|
||||
del notify
|
||||
ShowBase.notify.error("You must set 'want-dev' to false in non-debug mode.")
|
||||
|
|
|
|||
Loading…
Reference in New Issue