small fixes

This commit is contained in:
David Rose 2008-10-03 22:59:51 +00:00
parent 66f371f259
commit 35e77c0d01
3 changed files with 9 additions and 21 deletions

View File

@ -43,7 +43,11 @@ class Loader(DirectObject):
# special methods # special methods
def __init__(self, base): def __init__(self, base):
self.base = base self.base = base
self.loader = PandaLoader() # Temporary hasattr for old Pandas.
if hasattr(PandaLoader, 'getGlobalPtr'):
self.loader = PandaLoader.getGlobalPtr()
else:
self.loader = PandaLoader()
self.hook = "async_loader_%s" % (Loader.loaderIndex) self.hook = "async_loader_%s" % (Loader.loaderIndex)
Loader.loaderIndex += 1 Loader.loaderIndex += 1

View File

@ -45,22 +45,6 @@ import OnScreenDebug
__builtin__.FADE_SORT_INDEX = 1000 __builtin__.FADE_SORT_INDEX = 1000
__builtin__.NO_FADE_SORT_INDEX = 2000 __builtin__.NO_FADE_SORT_INDEX = 2000
####################################################
## expermential use of inter-frame yielding...
##
## this needs to be remove and problem cleared if we adopt this model..
##
####################################################
want_fifothreads = config.GetBool("want-fifothreads", 0)
if want_fifothreads:
class HackGraphicsEngine(GraphicsEngine):
def renderFrame(self):
if isinstance(Thread.getCurrentThread(), MainThread):
GraphicsEngine.renderFrame(self)
else:
print 'renderFrame Not Main Thread %s' % (repr(Thread.getCurrentThread()))
# Now ShowBase is a DirectObject. We need this so ShowBase can hang # Now ShowBase is a DirectObject. We need this so ShowBase can hang
# hooks on messages, particularly on window-event. This doesn't # hooks on messages, particularly on window-event. This doesn't
@ -183,9 +167,9 @@ class ShowBase(DirectObject.DirectObject):
self.hidden = NodePath('hidden') self.hidden = NodePath('hidden')
# We need a graphics engine to manage the actual rendering. # Temporary hasattr for old pandas.
if want_fifothreads: if hasattr(GraphicsEngine, 'getGlobalPtr'):
self.graphicsEngine = HackGraphicsEngine() self.graphicsEngine = GraphicsEngine.getGlobalPtr()
else: else:
self.graphicsEngine = GraphicsEngine() self.graphicsEngine = GraphicsEngine()

View File

@ -377,7 +377,7 @@ class TaskManager:
# Set the clock to have last frame's time in case we were # Set the clock to have last frame's time in case we were
# Paused at the prompt for a long time # Paused at the prompt for a long time
t = self.globalClock.getFrameTime() t = self.globalClock.getFrameTime()
timeDelta = t - globalClock.getRealTime() timeDelta = t - self.globalClock.getRealTime()
self.globalClock.setRealTime(t) self.globalClock.setRealTime(t)
messenger.send("resetClock", [timeDelta]) messenger.send("resetClock", [timeDelta])