*** empty log message ***
This commit is contained in:
parent
aa394a2e95
commit
e2a3d907e5
|
|
@ -36,6 +36,8 @@ class ShowBase:
|
|||
self.wantDIRECT = self.config.GetBool('want-directtools', 0)
|
||||
self.wantStats = self.config.GetBool('want-stats', 0)
|
||||
|
||||
taskMgr.taskTimerVerbose = self.config.GetBool('task-timer-verbose', 0)
|
||||
|
||||
self.initialState = NodeAttributes()
|
||||
# Set a default "off color" (i.e. use poly color) for color transitions
|
||||
self.initialState.setAttribute(ColorTransition.getClassType(),
|
||||
|
|
@ -61,7 +63,7 @@ class ShowBase:
|
|||
# stores a CollisionTraverser pointer here, we'll traverse it
|
||||
# in the igloop task.
|
||||
self.cTrav = 0
|
||||
|
||||
|
||||
# This is a list of cams associated with the display region's cameras
|
||||
self.camList = []
|
||||
for camera in self.cameraList:
|
||||
|
|
@ -131,7 +133,7 @@ class ShowBase:
|
|||
# Particle manager
|
||||
self.particleMgr = particleMgr
|
||||
self.particleMgr.setFrameStepping(1)
|
||||
self.particleMgrEnabled = 0
|
||||
self.particleMgrEnabled = 0
|
||||
|
||||
# Physics manager
|
||||
self.physicsMgr = physicsMgr
|
||||
|
|
@ -166,8 +168,8 @@ class ShowBase:
|
|||
|
||||
def disableParticles(self):
|
||||
"""enableParticles(self)"""
|
||||
self.particleMgrEnabled = 0
|
||||
self.physicsMgrEnabled = 0
|
||||
self.particleMgrEnabled = 0
|
||||
self.physicsMgrEnabled = 0
|
||||
self.taskMgr.removeTasksNamed('manager-update')
|
||||
|
||||
def toggleParticles(self):
|
||||
|
|
@ -188,7 +190,7 @@ class ShowBase:
|
|||
if (self.particleMgrEnabled == 1):
|
||||
self.particleMgr.doParticles(dt)
|
||||
if (self.physicsMgrEnabled == 1):
|
||||
self.physicsMgr.doPhysics(dt)
|
||||
self.physicsMgr.doPhysics(dt)
|
||||
return Task.cont
|
||||
|
||||
def createStats(self):
|
||||
|
|
@ -200,7 +202,7 @@ class ShowBase:
|
|||
def createAudioManager(self):
|
||||
if self.wantSound:
|
||||
AudioManager.spawnUpdate()
|
||||
|
||||
|
||||
def createRootPanel(self):
|
||||
if self.wantTk:
|
||||
from TkGlobal import *
|
||||
|
|
@ -224,9 +226,9 @@ class ShowBase:
|
|||
|
||||
# Finally, render the frame.
|
||||
self.win.update()
|
||||
|
||||
|
||||
return Task.cont
|
||||
|
||||
|
||||
def restart(self):
|
||||
self.shutdown()
|
||||
# give the igloop task a reasonably "late" priority,
|
||||
|
|
@ -330,7 +332,7 @@ class ShowBase:
|
|||
|
||||
# If oobeMode was never set, set it to false and create the
|
||||
# structures we need to implement OOBE.
|
||||
|
||||
|
||||
try:
|
||||
self.oobeMode
|
||||
except:
|
||||
|
|
@ -388,14 +390,14 @@ class ShowBase:
|
|||
mat = Mat4.translateMat(0, -10, 3) * base.camera.getMat(cameraParent)
|
||||
mat.invertInPlace()
|
||||
self.oobeTrackball.node().setMat(mat)
|
||||
|
||||
|
||||
self.cam.reparentTo(self.oobeCameraTrackball)
|
||||
if not self.oobeVis.isEmpty():
|
||||
self.oobeVis.reparentTo(self.camera)
|
||||
self.oobeMode = 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def run(self):
|
||||
self.taskMgr.run()
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ def make_sequence(taskList):
|
|||
return done
|
||||
else:
|
||||
task = self.taskList[self.index]
|
||||
# If this is a new task, set it's start time and frame
|
||||
# If this is a new task, set its start time and frame
|
||||
if (self.index > self.prevIndex):
|
||||
task.setStartTimeFrame(self.time, self.frame)
|
||||
self.prevIndex = self.index
|
||||
|
|
@ -258,6 +258,7 @@ class TaskManager:
|
|||
if (TaskManager.notify == None):
|
||||
TaskManager.notify = directNotify.newCategory("TaskManager")
|
||||
# TaskManager.notify.setDebug(1)
|
||||
self.taskTimerVerbose = 0
|
||||
|
||||
def stepping(value):
|
||||
self.stepping = value
|
||||
|
|
@ -347,25 +348,29 @@ class TaskManager:
|
|||
for task in self.taskList:
|
||||
task.setCurrentTimeFrame(self.currentTime, self.currentFrame)
|
||||
|
||||
# Run the task and check the return value
|
||||
startTime = time.clock()
|
||||
ret = task(task)
|
||||
endTime = time.clock()
|
||||
|
||||
# Record the dt
|
||||
dt = endTime - startTime
|
||||
task.dt = dt
|
||||
|
||||
# See if this is the new max
|
||||
if dt > task.maxDt:
|
||||
task.maxDt = dt
|
||||
|
||||
# Record the running total of all dts so we can compute an average
|
||||
task.runningTotal = task.runningTotal + dt
|
||||
if (task.frame > 0):
|
||||
task.avgDt = (task.runningTotal / task.frame)
|
||||
if (self.taskTimerVerbose == 0):
|
||||
# don't record timing info
|
||||
ret = task(task)
|
||||
else:
|
||||
task.avgDt = 0
|
||||
# Run the task and check the return value
|
||||
startTime = time.clock()
|
||||
ret = task(task)
|
||||
endTime = time.clock()
|
||||
|
||||
# Record the dt
|
||||
dt = endTime - startTime
|
||||
task.dt = dt
|
||||
|
||||
# See if this is the new max
|
||||
if dt > task.maxDt:
|
||||
task.maxDt = dt
|
||||
|
||||
# Record the running total of all dts so we can compute an average
|
||||
task.runningTotal = task.runningTotal + dt
|
||||
if (task.frame > 0):
|
||||
task.avgDt = (task.runningTotal / task.frame)
|
||||
else:
|
||||
task.avgDt = 0
|
||||
|
||||
# See if the task is done
|
||||
if (ret == cont):
|
||||
|
|
@ -416,7 +421,7 @@ class TaskManager:
|
|||
method.im_self,
|
||||
method.im_class)
|
||||
task.__call__ = newMethod
|
||||
# Found it retrun true
|
||||
# Found it return true
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
|
@ -437,17 +442,31 @@ class TaskManager:
|
|||
for task in self.taskList:
|
||||
totalDt = totalDt + task.dt
|
||||
totalAvgDt = totalAvgDt + task.avgDt
|
||||
str = str + (task.name.ljust(taskNameWidth)
|
||||
+ fpformat.fix(task.dt*1000, 2).rjust(dtWidth)
|
||||
+ fpformat.fix(task.avgDt*1000, 2).rjust(dtWidth)
|
||||
+ fpformat.fix(task.maxDt*1000, 2).rjust(dtWidth)
|
||||
+ `task.getPriority()`.rjust(priorityWidth)
|
||||
+ '\n')
|
||||
if (self.taskTimerVerbose):
|
||||
str = str + (task.name.ljust(taskNameWidth)
|
||||
+ fpformat.fix(task.dt*1000, 2).rjust(dtWidth)
|
||||
+ fpformat.fix(task.avgDt*1000, 2).rjust(dtWidth)
|
||||
+ fpformat.fix(task.maxDt*1000, 2).rjust(dtWidth)
|
||||
+ `task.getPriority()`.rjust(priorityWidth)
|
||||
+ '\n')
|
||||
else:
|
||||
str = str + (task.name.ljust(taskNameWidth)
|
||||
+ '----'.rjust(dtWidth)
|
||||
+ '----'.rjust(dtWidth)
|
||||
+ '----'.rjust(dtWidth)
|
||||
+ `task.getPriority()`.rjust(priorityWidth)
|
||||
+ '\n')
|
||||
str = str + '---------------------------------------------------------------\n'
|
||||
str = str + ('total'.ljust(taskNameWidth)
|
||||
+ fpformat.fix(totalDt*1000, 2).rjust(dtWidth)
|
||||
+ fpformat.fix(totalAvgDt*1000, 2).rjust(dtWidth)
|
||||
+ '\n')
|
||||
if (self.taskTimerVerbose):
|
||||
str = str + ('total'.ljust(taskNameWidth)
|
||||
+ fpformat.fix(totalDt*1000, 2).rjust(dtWidth)
|
||||
+ fpformat.fix(totalAvgDt*1000, 2).rjust(dtWidth)
|
||||
+ '\n')
|
||||
else:
|
||||
str = str + ('total'.ljust(taskNameWidth)
|
||||
+ '----'.rjust(dtWidth)
|
||||
+ '----'.rjust(dtWidth)
|
||||
+ '\n')
|
||||
return str
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue