mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
need garbageCollectStates task
This commit is contained in:
parent
e722b48c02
commit
48df7995e5
@ -862,7 +862,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
else:
|
else:
|
||||||
# Spawn it after igloop (at the end of each frame)
|
# Spawn it after igloop (at the end of each frame)
|
||||||
self.taskMgr.remove('clientSleep')
|
self.taskMgr.remove('clientSleep')
|
||||||
self.taskMgr.add(self.sleepCycleTask, 'clientSleep', priority = 55)
|
self.taskMgr.add(self.sleepCycleTask, 'clientSleep', sort = 55)
|
||||||
|
|
||||||
def sleepCycleTask(self, task):
|
def sleepCycleTask(self, task):
|
||||||
Thread.sleep(self.clientSleep)
|
Thread.sleep(self.clientSleep)
|
||||||
@ -1696,6 +1696,17 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
x.update()
|
x.update()
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
|
def __garbageCollectStates(self, state):
|
||||||
|
""" This task is started only when we have
|
||||||
|
garbage-collect-states set in the Config.prc file, in which
|
||||||
|
case we're responsible for taking out Panda's garbage from
|
||||||
|
time to time. This is not to be confused with Python's
|
||||||
|
garbage collection. """
|
||||||
|
|
||||||
|
TransformState.garbageCollect()
|
||||||
|
RenderState.garbageCollect()
|
||||||
|
return Task.cont
|
||||||
|
|
||||||
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().
|
||||||
@ -1784,29 +1795,31 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.shutdown()
|
self.shutdown()
|
||||||
# __resetPrevTransform goes at the very beginning of the frame.
|
# __resetPrevTransform goes at the very beginning of the frame.
|
||||||
self.taskMgr.add(
|
self.taskMgr.add(
|
||||||
self.__resetPrevTransform, 'resetPrevTransform', priority = -51)
|
self.__resetPrevTransform, 'resetPrevTransform', sort = -51)
|
||||||
# give the dataLoop task a reasonably "early" priority,
|
# give the dataLoop task a reasonably "early" sort,
|
||||||
# so that it will get run before most tasks
|
# so that it will get run before most tasks
|
||||||
self.taskMgr.add(self.__dataLoop, 'dataLoop', priority = -50)
|
self.taskMgr.add(self.__dataLoop, 'dataLoop', sort = -50)
|
||||||
self.__deadInputs = 0
|
self.__deadInputs = 0
|
||||||
# spawn the ivalLoop with a later priority, so that it will
|
# spawn the ivalLoop with a later sort, so that it will
|
||||||
# run after most tasks, but before igLoop.
|
# run after most tasks, but before igLoop.
|
||||||
self.taskMgr.add(self.__ivalLoop, 'ivalLoop', priority = 20)
|
self.taskMgr.add(self.__ivalLoop, 'ivalLoop', sort = 20)
|
||||||
# make the collisionLoop task run before igLoop,
|
# make the collisionLoop task run before igLoop,
|
||||||
# but leave enough room for the app to insert tasks
|
# but leave enough room for the app to insert tasks
|
||||||
# between collisionLoop and igLoop
|
# between collisionLoop and igLoop
|
||||||
self.taskMgr.add(self.__collisionLoop, 'collisionLoop', priority = 30)
|
self.taskMgr.add(self.__collisionLoop, 'collisionLoop', sort = 30)
|
||||||
|
|
||||||
# give the igLoop task a reasonably "late" priority,
|
if ConfigVariableBool('garbage-collect-states').getValue():
|
||||||
|
self.taskMgr.add(self.__garbageCollectStates, 'garbageCollectStates', sort = 46)
|
||||||
|
# give the igLoop task a reasonably "late" sort,
|
||||||
# so that it will get run after most tasks
|
# so that it will get run after most tasks
|
||||||
self.cluster = cluster
|
self.cluster = cluster
|
||||||
if (not clusterSync or (cluster == None)):
|
if (not clusterSync or (cluster == None)):
|
||||||
self.taskMgr.add(self.__igLoop, 'igLoop', priority = 50)
|
self.taskMgr.add(self.__igLoop, 'igLoop', sort = 50)
|
||||||
else:
|
else:
|
||||||
self.taskMgr.add(self.__igLoopSync, 'igLoop', priority = 50)
|
self.taskMgr.add(self.__igLoopSync, 'igLoop', sort = 50)
|
||||||
# the audioLoop updates the positions of 3D sounds.
|
# the audioLoop updates the positions of 3D sounds.
|
||||||
# as such, it needs to run after the cull traversal in the igLoop.
|
# as such, it needs to run after the cull traversal in the igLoop.
|
||||||
self.taskMgr.add(self.__audioLoop, 'audioLoop', priority = 60)
|
self.taskMgr.add(self.__audioLoop, 'audioLoop', sort = 60)
|
||||||
self.eventMgr.restart()
|
self.eventMgr.restart()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
@ -1817,6 +1830,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.taskMgr.remove('dataLoop')
|
self.taskMgr.remove('dataLoop')
|
||||||
self.taskMgr.remove('resetPrevTransform')
|
self.taskMgr.remove('resetPrevTransform')
|
||||||
self.taskMgr.remove('ivalLoop')
|
self.taskMgr.remove('ivalLoop')
|
||||||
|
self.taskMgr.remove('garbage_collect')
|
||||||
self.eventMgr.shutdown()
|
self.eventMgr.shutdown()
|
||||||
|
|
||||||
def getBackgroundColor(self, win = None):
|
def getBackgroundColor(self, win = None):
|
||||||
@ -1939,7 +1953,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.eventMgr.doEvents()
|
self.eventMgr.doEvents()
|
||||||
self.dgTrav.traverse(base.dataRootNode)
|
self.dgTrav.traverse(base.dataRootNode)
|
||||||
self.eventMgr.eventQueue.clear()
|
self.eventMgr.eventQueue.clear()
|
||||||
self.taskMgr.add(self.__dataLoop, 'dataLoop', priority = -50)
|
self.taskMgr.add(self.__dataLoop, 'dataLoop', sort = -50)
|
||||||
self.__deadInputs = 0
|
self.__deadInputs = 0
|
||||||
|
|
||||||
def setMouseOnNode(self, newNode):
|
def setMouseOnNode(self, newNode):
|
||||||
|
@ -137,7 +137,7 @@ open_framework(int &argc, char **&argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (garbage_collect_states) {
|
if (garbage_collect_states) {
|
||||||
PT(GenericAsyncTask) task = new GenericAsyncTask("garbage_collect", task_garbage_collect, this);
|
PT(GenericAsyncTask) task = new GenericAsyncTask("garbageCollectStates", task_garbage_collect, this);
|
||||||
task->set_sort(46);
|
task->set_sort(46);
|
||||||
_task_mgr.add(task);
|
_task_mgr.add(task);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user