From 0d0a65752963b7b53eb050ce0c232969d366b1e5 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 21 Feb 2001 01:45:05 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/showbase/ShowBase.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 356fdf24b3..c472402efd 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -117,7 +117,6 @@ class ShowBase: # one is in use at a given time. self.trackball = self.dataUnused.attachNewNode(Trackball('trackball')) self.drive = self.dataUnused.attachNewNode(DriveInterface('drive')) - self.noMouse = self.dataUnused.attachNewNode('noMouse') self.mouse2cam = self.dataUnused.attachNewNode(Transform2SG('mouse2cam')) self.mouse2cam.node().setArc(self.camera.getBottomArc()) self.useDrive() @@ -253,12 +252,25 @@ class ShowBase: toggleWireframe(self.initialState) def disableMouse(self): - self.drive.reparentTo(self.dataUnused) - self.trackball.reparentTo(self.dataUnused) - self.noMouse.reparentTo(self.mouseValve, 0) + """ + Temporarily disable the mouse control of the camera, either + via the drive interface or the trackball, whichever is + currently in use. + """ + # We don't reparent the drive interface or the trackball; + # whichever one was there before will remain in the data graph + # and active. This way they won't lose button events while + # the mouse is disabled. However, we do move the mouse2cam + # object out of there, so we won't be updating the camera any + # more. self.mouse2cam.reparentTo(self.dataUnused) - self.mouseInterface = None - self.mouseInterfaceNode = None + + def enableMouse(self): + """ + Reverse the effect of a previous call to disableMouse(). + useDrive() also implicitly enables the mouse. + """ + self.mouse2cam.reparentTo(self.mouseInterface) def setMouseOnArc(self, newArc): self.mouse2cam.node().setArc(newArc) @@ -269,7 +281,6 @@ class ShowBase: """ # Get rid of the trackball self.trackball.reparentTo(self.dataUnused) - self.noMouse.reparentTo(self.dataUnused) # Update the mouseInterface to point to the drive self.mouseInterface = self.drive self.mouseInterfaceNode = self.mouseInterface.getBottomNode() @@ -287,7 +298,6 @@ class ShowBase: """ # Get rid of the drive self.drive.reparentTo(self.dataUnused) - self.noMouse.reparentTo(self.dataUnused) # Update the mouseInterface to point to the trackball self.mouseInterface = self.trackball self.mouseInterfaceNode = self.mouseInterface.getBottomNode()