|
@@ -44,9 +44,6 @@ if __debug__:
|
|
|
import OnScreenDebug
|
|
import OnScreenDebug
|
|
|
import AppRunnerGlobal
|
|
import AppRunnerGlobal
|
|
|
|
|
|
|
|
-builtins.FADE_SORT_INDEX = 1000
|
|
|
|
|
-builtins.NO_FADE_SORT_INDEX = 2000
|
|
|
|
|
-
|
|
|
|
|
def legacyRun():
|
|
def legacyRun():
|
|
|
builtins.base.notify.warning("run() is deprecated, use base.run() instead")
|
|
builtins.base.notify.warning("run() is deprecated, use base.run() instead")
|
|
|
builtins.base.run()
|
|
builtins.base.run()
|
|
@@ -331,7 +328,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
# assigned to a single CPU
|
|
# assigned to a single CPU
|
|
|
autoAffinity = self.config.GetBool('auto-single-cpu-affinity', 0)
|
|
autoAffinity = self.config.GetBool('auto-single-cpu-affinity', 0)
|
|
|
affinity = None
|
|
affinity = None
|
|
|
- if autoAffinity and ('clientIndex' in builtins.__dict__):
|
|
|
|
|
|
|
+ if autoAffinity and hasattr(builtins, 'clientIndex'):
|
|
|
affinity = abs(int(builtins.clientIndex))
|
|
affinity = abs(int(builtins.clientIndex))
|
|
|
else:
|
|
else:
|
|
|
affinity = self.config.GetInt('client-cpu-affinity', -1)
|
|
affinity = self.config.GetInt('client-cpu-affinity', -1)
|
|
@@ -342,7 +339,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32))
|
|
TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32))
|
|
|
|
|
|
|
|
# Make sure we're not making more than one ShowBase.
|
|
# Make sure we're not making more than one ShowBase.
|
|
|
- if 'base' in builtins.__dict__:
|
|
|
|
|
|
|
+ if hasattr(builtins, 'base'):
|
|
|
raise StandardError, "Attempt to spawn multiple ShowBase instances!"
|
|
raise StandardError, "Attempt to spawn multiple ShowBase instances!"
|
|
|
|
|
|
|
|
# DO NOT ADD TO THIS LIST. We're trying to phase out the use of
|
|
# DO NOT ADD TO THIS LIST. We're trying to phase out the use of
|
|
@@ -374,24 +371,26 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
builtins.wantUberdog = self.config.GetBool('want-uberdog', 1)
|
|
builtins.wantUberdog = self.config.GetBool('want-uberdog', 1)
|
|
|
if __debug__:
|
|
if __debug__:
|
|
|
builtins.deltaProfiler = DeltaProfiler.DeltaProfiler("ShowBase")
|
|
builtins.deltaProfiler = DeltaProfiler.DeltaProfiler("ShowBase")
|
|
|
- builtins.onScreenDebug = OnScreenDebug.OnScreenDebug()
|
|
|
|
|
|
|
+ self.onScreenDebug = OnScreenDebug.OnScreenDebug()
|
|
|
|
|
+ builtins.onScreenDebug = self.onScreenDebug
|
|
|
|
|
|
|
|
if self.wantRender2dp:
|
|
if self.wantRender2dp:
|
|
|
builtins.render2dp = self.render2dp
|
|
builtins.render2dp = self.render2dp
|
|
|
builtins.aspect2dp = self.aspect2dp
|
|
builtins.aspect2dp = self.aspect2dp
|
|
|
builtins.pixel2dp = self.pixel2dp
|
|
builtins.pixel2dp = self.pixel2dp
|
|
|
|
|
|
|
|
- if __dev__:
|
|
|
|
|
- ShowBase.notify.debug('__dev__ == %s' % __dev__)
|
|
|
|
|
|
|
+ if self.__dev__:
|
|
|
|
|
+ ShowBase.notify.debug('__dev__ == %s' % self.__dev__)
|
|
|
else:
|
|
else:
|
|
|
- ShowBase.notify.info('__dev__ == %s' % __dev__)
|
|
|
|
|
|
|
+ ShowBase.notify.info('__dev__ == %s' % self.__dev__)
|
|
|
|
|
|
|
|
self.createBaseAudioManagers()
|
|
self.createBaseAudioManagers()
|
|
|
|
|
|
|
|
# set up recording of Functor creation stacks in __dev__
|
|
# set up recording of Functor creation stacks in __dev__
|
|
|
- PythonUtil.recordFunctorCreationStacks()
|
|
|
|
|
|
|
+ if self.__dev__ and self.config.GetBool('record-functor-creation-stacks', False):
|
|
|
|
|
+ PythonUtil.recordFunctorCreationStacks()
|
|
|
|
|
|
|
|
- if __dev__ or self.config.GetBool('want-e3-hacks', False):
|
|
|
|
|
|
|
+ if self.__dev__ or self.config.GetBool('want-e3-hacks', False):
|
|
|
if self.config.GetBool('track-gui-items', True):
|
|
if self.config.GetBool('track-gui-items', True):
|
|
|
# dict of guiId to gui item, for tracking down leaks
|
|
# dict of guiId to gui item, for tracking down leaks
|
|
|
self.guiItems = {}
|
|
self.guiItems = {}
|
|
@@ -432,9 +431,10 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
|
|
|
|
|
# Offscreen buffer viewing utility.
|
|
# Offscreen buffer viewing utility.
|
|
|
# This needs to be allocated even if the viewer is off.
|
|
# This needs to be allocated even if the viewer is off.
|
|
|
- self.bufferViewer = BufferViewer()
|
|
|
|
|
if self.wantRender2dp:
|
|
if self.wantRender2dp:
|
|
|
- self.bufferViewer.setRenderParent(self.render2dp)
|
|
|
|
|
|
|
+ self.bufferViewer = BufferViewer(self.win, self.render2dp)
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.bufferViewer = BufferViewer(self.win, self.render2d)
|
|
|
|
|
|
|
|
if self.windowType != 'none':
|
|
if self.windowType != 'none':
|
|
|
if fStartDirect: # [gjeon] if this is False let them start direct manually
|
|
if fStartDirect: # [gjeon] if this is False let them start direct manually
|
|
@@ -1886,7 +1886,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
def __igLoop(self, state):
|
|
def __igLoop(self, state):
|
|
|
# We render the watch variables for the onScreenDebug as soon
|
|
# We render the watch variables for the onScreenDebug as soon
|
|
|
# as we reasonably can before the renderFrame().
|
|
# as we reasonably can before the renderFrame().
|
|
|
- onScreenDebug.render()
|
|
|
|
|
|
|
+ self.onScreenDebug.render()
|
|
|
|
|
|
|
|
if self.recorder:
|
|
if self.recorder:
|
|
|
self.recorder.recordFrame()
|
|
self.recorder.recordFrame()
|
|
@@ -1900,7 +1900,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
|
|
|
|
|
# We clear the text buffer for the onScreenDebug as soon
|
|
# We clear the text buffer for the onScreenDebug as soon
|
|
|
# as we reasonably can after the renderFrame().
|
|
# as we reasonably can after the renderFrame().
|
|
|
- onScreenDebug.clear()
|
|
|
|
|
|
|
+ self.onScreenDebug.clear()
|
|
|
|
|
|
|
|
if self.recorder:
|
|
if self.recorder:
|
|
|
self.recorder.playFrame()
|
|
self.recorder.playFrame()
|
|
@@ -1925,12 +1925,11 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
def __igLoopSync(self, state):
|
|
def __igLoopSync(self, state):
|
|
|
# We render the watch variables for the onScreenDebug as soon
|
|
# We render the watch variables for the onScreenDebug as soon
|
|
|
# as we reasonably can before the renderFrame().
|
|
# as we reasonably can before the renderFrame().
|
|
|
- onScreenDebug.render()
|
|
|
|
|
|
|
+ self.onScreenDebug.render()
|
|
|
|
|
|
|
|
if self.recorder:
|
|
if self.recorder:
|
|
|
self.recorder.recordFrame()
|
|
self.recorder.recordFrame()
|
|
|
|
|
|
|
|
-
|
|
|
|
|
self.cluster.collectData()
|
|
self.cluster.collectData()
|
|
|
|
|
|
|
|
# Finally, render the frame.
|
|
# Finally, render the frame.
|
|
@@ -1942,7 +1941,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
|
|
|
|
|
# We clear the text buffer for the onScreenDebug as soon
|
|
# We clear the text buffer for the onScreenDebug as soon
|
|
|
# as we reasonably can after the renderFrame().
|
|
# as we reasonably can after the renderFrame().
|
|
|
- onScreenDebug.clear()
|
|
|
|
|
|
|
+ self.onScreenDebug.clear()
|
|
|
|
|
|
|
|
if self.recorder:
|
|
if self.recorder:
|
|
|
self.recorder.playFrame()
|
|
self.recorder.playFrame()
|