Browse Source

filter out run() in p3d file

David Rose 16 years ago
parent
commit
e7a5487ea1
2 changed files with 8 additions and 5 deletions
  1. 8 1
      direct/src/showbase/ShowBase.py
  2. 0 4
      direct/src/showutil/packp3d.py

+ 8 - 1
direct/src/showbase/ShowBase.py

@@ -2477,7 +2477,14 @@ class ShowBase(DirectObject.DirectObject):
         self.startDirect(fWantDirect = fDirect, fWantTk = fTk, fWantWx = fWx)
 
     def run(self):
-        self.taskMgr.run()
+        # This method only does anything when self.appRunner is None,
+        # which is to say, when we are not running from within a p3d
+        # file.  When we *are* within a p3d file, the Panda runtime
+        # has to be responsible for running the main loop, so we can't
+        # allow the application to do it.  This is a minor hack, but
+        # should work for 99% of the cases.
+        if self.appRunner is None:
+            self.taskMgr.run()
 
 
 # A class to encapsulate information necessary for multiwindow support.

+ 0 - 4
direct/src/showutil/packp3d.py

@@ -29,10 +29,6 @@ Options:
      (this is preferable to having the module start itself immediately
      upon importing).
 
-     Note that your main.py must *not* call run().  This call should
-     not be part of the p3d file--the Panda3D runtime must be free to
-     call it, not your code!
-
   -c [py,pyc,pyo]
 
      Specifies the compilation mode of python files.  'py' means to