start movie on the next frame

This commit is contained in:
David Rose 2005-10-04 14:36:50 +00:00
parent 0f01f99d2a
commit 4ceb6ccb17

View File

@ -1725,17 +1725,18 @@ class ShowBase(DirectObject.DirectObject):
globalClock.setMode(ClockObject.MNonRealTime) globalClock.setMode(ClockObject.MNonRealTime)
globalClock.setDt(1.0/float(fps)) globalClock.setDt(1.0/float(fps))
t = taskMgr.add(self._movieTask, namePrefix + '_task') t = taskMgr.add(self._movieTask, namePrefix + '_task')
t.frameIndex = 1 t.frameIndex = 0 # Frame 0 is not captured.
t.numFrames = int(duration * fps) t.numFrames = int(duration * fps)
t.source = source t.source = source
t.outputString = namePrefix + '_%0' + `sd` + 'd.' + format t.outputString = namePrefix + '_%0' + `sd` + 'd.' + format
t.uponDeath = lambda state: globalClock.setMode(ClockObject.MNormal) t.uponDeath = lambda state: globalClock.setMode(ClockObject.MNormal)
def _movieTask(self, state): def _movieTask(self, state):
frameName = state.outputString % state.frameIndex if state.frameIndex != 0:
self.notify.info("Capturing frame: " + frameName) frameName = state.outputString % state.frameIndex
self.screenshot(namePrefix = frameName, defaultFilename = 0, self.notify.info("Capturing frame: " + frameName)
source = state.source) self.screenshot(namePrefix = frameName, defaultFilename = 0,
source = state.source)
state.frameIndex += 1 state.frameIndex += 1
if state.frameIndex > state.numFrames: if state.frameIndex > state.numFrames: