|
@@ -86,6 +86,11 @@ class ShowBase:
|
|
|
self.renderTop.node(),
|
|
self.renderTop.node(),
|
|
|
self.initialState)
|
|
self.initialState)
|
|
|
self.win = chanConfig.getWin()
|
|
self.win = chanConfig.getWin()
|
|
|
|
|
+
|
|
|
|
|
+ # Now that we've assigned a window, assign an exitfunc.
|
|
|
|
|
+ self.oldexitfunc = getattr(sys, 'exitfunc', None)
|
|
|
|
|
+ sys.exitfunc = self.exitfunc
|
|
|
|
|
+
|
|
|
self.cameraList = []
|
|
self.cameraList = []
|
|
|
for i in range(chanConfig.getNumGroups()):
|
|
for i in range(chanConfig.getNumGroups()):
|
|
|
self.cameraList.append(self.render.attachNewNode(
|
|
self.cameraList.append(self.render.attachNewNode(
|
|
@@ -227,6 +232,25 @@ class ShowBase:
|
|
|
|
|
|
|
|
self.restart()
|
|
self.restart()
|
|
|
|
|
|
|
|
|
|
+ def exitfunc(self):
|
|
|
|
|
+ """exitfunc(self)
|
|
|
|
|
+
|
|
|
|
|
+ This should be assigned to sys.exitfunc to be called just
|
|
|
|
|
+ before Python shutdown. It guarantees that the Panda window
|
|
|
|
|
+ is closed cleanly, so that we free system resources, restore
|
|
|
|
|
+ the desktop and keyboard functionality, etc.
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ # temporary try..except for old pandas.
|
|
|
|
|
+ try:
|
|
|
|
|
+ self.win.closeWindow()
|
|
|
|
|
+ except:
|
|
|
|
|
+ pass
|
|
|
|
|
+
|
|
|
|
|
+ if self.oldexitfunc:
|
|
|
|
|
+ self.oldexitfunc()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def addAngularIntegrator(self):
|
|
def addAngularIntegrator(self):
|
|
|
"""addAngularIntegrator(self)"""
|
|
"""addAngularIntegrator(self)"""
|
|
|
if (self.physicsMgrAngular == 0):
|
|
if (self.physicsMgrAngular == 0):
|