def removeEverything(self): for task in self.taskMgr.getTasks(): if task.getName() not in ['dataLoop', 'igLoop']: task.remove() camera.reparentTo(render) for tex in render.findAllTextures(): tex.releaseAll() for tex in aspect2d.findAllTextures(): tex.releaseAll() for tex in render2d.findAllTextures(): tex.releaseAll() for tex in hidden.findAllTextures(): tex.releaseAll() for node in render.findAllMatches("**;+s"): node.removeNode() for node in aspect2d.findAllMatches("**;+s"): node.removeNode() for node in render2d.findAllMatches("**;+s"): node.removeNode() for node in hidden.findAllMatches("**;+s"): node.removeNode() TexturePool.garbageCollect() ModelPool.garbageCollect() RenderState.garbageCollect() RenderState.clearCache() RenderState.clearMungerCache() self.win.getGsg().getPreparedObjects().releaseAll() self.graphicsEngine.renderFrame()
def _checkForStateClear(self): """ This method regulary clears the state cache """ if not hasattr(self, "lastStateClear"): self.lastStateClear = 0 if Globals.clock.getFrameTime() - self.lastStateClear > self.settings.stateCacheClearInterval: RenderState.clearCache() TransformState.clearCache() self.lastStateClear = Globals.clock.getFrameTime()
def doSceneCleanup(): from panda3d.core import ModelPool, TexturePool, RenderState, RenderAttrib, TransformState, GeomCacheManager ModelPool.garbageCollect() TexturePool.garbageCollect() RenderState.clearMungerCache() RenderState.clearCache() RenderState.garbageCollect() RenderAttrib.garbageCollect() TransformState.clearCache() TransformState.garbageCollect() GeomCacheManager.getGlobalPtr().flush() base.graphicsEngine.renderFrame()