|
|
@@ -384,18 +384,19 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
|
|
|
# Get a pointer to Panda's global ClockObject, used for
|
|
|
# synchronizing events between Python and C.
|
|
|
- globalClock = ClockObject.getGlobalClock()
|
|
|
+ clock = ClockObject.getGlobalClock()
|
|
|
+ self.clock = clock
|
|
|
|
|
|
# Since we have already started up a TaskManager, and probably
|
|
|
# a number of tasks; and since the TaskManager had to use the
|
|
|
# TrueClock to tell time until this moment, make sure the
|
|
|
# globalClock object is exactly in sync with the TrueClock.
|
|
|
trueClock = TrueClock.getGlobalPtr()
|
|
|
- globalClock.setRealTime(trueClock.getShortTime())
|
|
|
- globalClock.tick()
|
|
|
+ clock.setRealTime(trueClock.getShortTime())
|
|
|
+ clock.tick()
|
|
|
|
|
|
- # Now we can make the TaskManager start using the new globalClock.
|
|
|
- taskMgr.globalClock = globalClock
|
|
|
+ # Now we can make the TaskManager start using the new clock.
|
|
|
+ taskMgr.globalClock = clock
|
|
|
|
|
|
# client CPU affinity is determined by, in order:
|
|
|
# - client-cpu-affinity-mask config
|
|
|
@@ -444,7 +445,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
builtins.ostream = Notify.out()
|
|
|
builtins.directNotify = directNotify
|
|
|
builtins.giveNotify = giveNotify
|
|
|
- builtins.globalClock = globalClock
|
|
|
+ builtins.globalClock = clock
|
|
|
builtins.vfs = vfs
|
|
|
builtins.cpMgr = ConfigPageManager.getGlobalPtr()
|
|
|
builtins.cvMgr = ConfigVariableManager.getGlobalPtr()
|
|
|
@@ -1899,7 +1900,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
return self.physicsMgrEnabled
|
|
|
|
|
|
def updateManagers(self, state):
|
|
|
- dt = globalClock.getDt()
|
|
|
+ dt = self.clock.dt
|
|
|
if self.particleMgrEnabled:
|
|
|
self.particleMgr.doParticles(dt)
|
|
|
if self.physicsMgrEnabled:
|
|
|
@@ -2927,14 +2928,15 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
Returns:
|
|
|
A `~direct.task.Task` that can be awaited.
|
|
|
"""
|
|
|
- globalClock.setMode(ClockObject.MNonRealTime)
|
|
|
- globalClock.setDt(1.0/float(fps))
|
|
|
+ clock = self.clock
|
|
|
+ clock.mode = ClockObject.MNonRealTime
|
|
|
+ clock.dt = 1.0 / fps
|
|
|
t = self.taskMgr.add(self._movieTask, namePrefix + '_task')
|
|
|
t.frameIndex = 0 # Frame 0 is not captured.
|
|
|
t.numFrames = int(duration * fps)
|
|
|
t.source = source
|
|
|
t.outputString = namePrefix + '_%0' + repr(sd) + 'd.' + format
|
|
|
- t.setUponDeath(lambda state: globalClock.setMode(ClockObject.MNormal))
|
|
|
+ t.setUponDeath(lambda state: clock.setMode(ClockObject.MNormal))
|
|
|
return t
|
|
|
|
|
|
def _movieTask(self, state):
|