Browse Source

showbase: Fix an entire DirectSession being (re)created on node selection

Closes #1051
Daniel 5 years ago
parent
commit
7eba53cffa
1 changed files with 6 additions and 0 deletions
  1. 6 0
      direct/src/showbase/ShowBase.py

+ 6 - 0
direct/src/showbase/ShowBase.py

@@ -157,6 +157,7 @@ class ShowBase(DirectObject.DirectObject):
         self.wantStats = self.config.GetBool('want-pstats', 0)
         self.wantStats = self.config.GetBool('want-pstats', 0)
         self.wantTk = False
         self.wantTk = False
         self.wantWx = False
         self.wantWx = False
+        self.wantDirect = False
 
 
         #: Fill this in with a function to invoke when the user "exits"
         #: Fill this in with a function to invoke when the user "exits"
         #: the program by closing the main window.
         #: the program by closing the main window.
@@ -3270,7 +3271,12 @@ class ShowBase(DirectObject.DirectObject):
     def startDirect(self, fWantDirect = 1, fWantTk = 1, fWantWx = 0):
     def startDirect(self, fWantDirect = 1, fWantTk = 1, fWantWx = 0):
         self.startTk(fWantTk)
         self.startTk(fWantTk)
         self.startWx(fWantWx)
         self.startWx(fWantWx)
+
+        if self.wantDirect == fWantDirect:
+            return
+
         self.wantDirect = fWantDirect
         self.wantDirect = fWantDirect
+
         if self.wantDirect:
         if self.wantDirect:
             # Use importlib to prevent this import from being picked up
             # Use importlib to prevent this import from being picked up
             # by modulefinder when packaging an application.
             # by modulefinder when packaging an application.