From 7eba53cffac5e57e1e2e192d17d4ea92a4c8d14c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 14 Nov 2020 02:09:25 +0200 Subject: [PATCH] showbase: Fix an entire DirectSession being (re)created on node selection Closes #1051 --- direct/src/showbase/ShowBase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 1eb66ad94d..72197ffabf 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -157,6 +157,7 @@ class ShowBase(DirectObject.DirectObject): self.wantStats = self.config.GetBool('want-pstats', 0) self.wantTk = False self.wantWx = False + self.wantDirect = False #: Fill this in with a function to invoke when the user "exits" #: the program by closing the main window. @@ -3270,7 +3271,12 @@ class ShowBase(DirectObject.DirectObject): def startDirect(self, fWantDirect = 1, fWantTk = 1, fWantWx = 0): self.startTk(fWantTk) self.startWx(fWantWx) + + if self.wantDirect == fWantDirect: + return + self.wantDirect = fWantDirect + if self.wantDirect: # Use importlib to prevent this import from being picked up # by modulefinder when packaging an application.