Browse Source

direct: Remove throw_new_frame from libp3showbase (see #1014)

rdb 2 months ago
parent
commit
93a1da82a1

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

@@ -62,6 +62,7 @@ from panda3d.core import (
     DepthTestAttrib,
     DepthTestAttrib,
     DepthWriteAttrib,
     DepthWriteAttrib,
     DriveInterface,
     DriveInterface,
+    EventQueue,
     ExecutionEnvironment,
     ExecutionEnvironment,
     Filename,
     Filename,
     FisheyeMaker,
     FisheyeMaker,
@@ -114,7 +115,7 @@ from panda3d.core import (
     WindowProperties,
     WindowProperties,
     getModelPath,
     getModelPath,
 )
 )
-from panda3d.direct import throw_new_frame, init_app_for_gui
+from panda3d.direct import init_app_for_gui
 from panda3d.direct import storeAccessibilityShortcutKeys, allowAccessibilityShortcutKeys
 from panda3d.direct import storeAccessibilityShortcutKeys, allowAccessibilityShortcutKeys
 from . import DConfig
 from . import DConfig
 
 
@@ -2284,9 +2285,8 @@ class ShowBase(DirectObject.DirectObject):
             # now until someone complains.
             # now until someone complains.
             time.sleep(0.1)
             time.sleep(0.1)
 
 
-        # Lerp stuff needs this event, and it must be generated in
-        # C++, not in Python.
-        throw_new_frame()
+        # Lerp stuff needs this event, thrown directly on the C++ queue.
+        EventQueue.getGlobalEventQueue().queueEvent("NewFrame")
         return Task.cont
         return Task.cont
 
 
     def __igLoopSync(self, state: object) -> int:
     def __igLoopSync(self, state: object) -> int:
@@ -2332,9 +2332,8 @@ class ShowBase(DirectObject.DirectObject):
         self.cluster.waitForFlipCommand()
         self.cluster.waitForFlipCommand()
         self.graphicsEngine.flipFrame()
         self.graphicsEngine.flipFrame()
 
 
-        # Lerp stuff needs this event, and it must be generated in
-        # C++, not in Python.
-        throw_new_frame()
+        # Lerp stuff needs this event, thrown directly on the C++ queue.
+        EventQueue.getGlobalEventQueue().queueEvent("NewFrame")
         return Task.cont
         return Task.cont
 
 
     def restart(self, clusterSync: bool = False, cluster=None) -> None:
     def restart(self, clusterSync: bool = False, cluster=None) -> None:

+ 0 - 8
direct/src/showbase/showBase.cxx

@@ -21,7 +21,6 @@ extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
 
 
 #include "showBase.h"
 #include "showBase.h"
 
 
-#include "throw_event.h"
 #include "graphicsWindow.h"
 #include "graphicsWindow.h"
 #include "renderBuffer.h"
 #include "renderBuffer.h"
 #include "camera.h"
 #include "camera.h"
@@ -45,13 +44,6 @@ ConfigureDef(config_showbase);
 ConfigureFn(config_showbase) {
 ConfigureFn(config_showbase) {
 }
 }
 
 
-// Throw the "NewFrame" event in the C++ world.  Some of the lerp code depends
-// on receiving this.
-void
-throw_new_frame() {
-  throw_event("NewFrame");
-}
-
 // Initialize the application for making a Gui-based app, such as wx.  At the
 // Initialize the application for making a Gui-based app, such as wx.  At the
 // moment, this is a no-op except on Mac.
 // moment, this is a no-op except on Mac.
 void
 void

+ 0 - 3
direct/src/showbase/showBase.h

@@ -16,7 +16,6 @@
 
 
 #include "directbase.h"
 #include "directbase.h"
 
 
-#include "eventHandler.h"
 #include "graphicsWindow.h"
 #include "graphicsWindow.h"
 #include "graphicsPipe.h"
 #include "graphicsPipe.h"
 #include "animControl.h"
 #include "animControl.h"
@@ -32,8 +31,6 @@ class GraphicsEngine;
 
 
 BEGIN_PUBLISH
 BEGIN_PUBLISH
 
 
-EXPCL_DIRECT_SHOWBASE void throw_new_frame();
-
 EXPCL_DIRECT_SHOWBASE void init_app_for_gui();
 EXPCL_DIRECT_SHOWBASE void init_app_for_gui();
 
 
 // to handle windows stickykeys
 // to handle windows stickykeys