diff --git a/direct/src/controls/ControlManager.py b/direct/src/controls/ControlManager.py index d09efe5772..939c775199 100755 --- a/direct/src/controls/ControlManager.py +++ b/direct/src/controls/ControlManager.py @@ -41,9 +41,6 @@ class ControlManager: ist.append(inputState.watchWithModifiers("reverse", "mouse4", inputSource=inputState.Mouse)) if self.wantWASD: - - - ist.append(inputState.watchWithModifiers("turnLeft", "arrow_left", inputSource=inputState.ArrowKeys)) ist.append(inputState.watch("turnLeft", "mouse-look_left", "mouse-look_left-done")) ist.append(inputState.watch("turnLeft", "force-turnLeft", "force-turnLeft-stop")) @@ -61,7 +58,6 @@ class ControlManager: # Used to switch between strafe and turn. We will default to turn self.WASDTurnTokens = () self.setWASDTurn(1) - else: ist.append(inputState.watchWithModifiers("turnLeft", "arrow_left", inputSource=inputState.ArrowKeys)) ist.append(inputState.watch("turnLeft", "mouse-look_left", "mouse-look_left-done")) @@ -109,7 +105,8 @@ class ControlManager: the controls when they were added (e.g. using the add(, ) call). - Remove a control instance from the list of available control systems. + Remove a control instance from the list of + available control systems. See also: add(). """ diff --git a/direct/src/controls/InputState.py b/direct/src/controls/InputState.py index 8b41599c94..e1d5437082 100755 --- a/direct/src/controls/InputState.py +++ b/direct/src/controls/InputState.py @@ -133,6 +133,9 @@ class InputState(DirectObject.DirectObject): name, eventOn, eventOff, startState)) if inputSource is None: inputSource = "eventPair('%s','%s')" % (eventOn, eventOff) + # Do we really need to reset the input state just because + # we're watching it? Remember, there may be multiple things + # watching this input state. self.set(name, startState, inputSource) token = InputStateWatchToken(self) # make the token listen for the events, to allow multiple listeners for the same event @@ -162,7 +165,11 @@ class InputState(DirectObject.DirectObject): DirectObject.DirectObject.ignore(self, eventOff) if len(self._watching[inputSource]) == 0: del self._watching[inputSource] - self.set(name, False, inputSource) + + # I commented this out because we shouldn't be modifying an + # input state simply because we're not looking at it anymore. + # self.set(name, False, inputSource) + def force(self, name, value, inputSource): """ diff --git a/direct/src/controls/ShipPilot.py b/direct/src/controls/ShipPilot.py index ab657add8a..da14c744f2 100755 --- a/direct/src/controls/ShipPilot.py +++ b/direct/src/controls/ShipPilot.py @@ -328,7 +328,7 @@ class ShipPilot(PhysicsWalker): base.localAvatar.getPos().pPrintValues(),)) onScreenDebug.append("localAvatar hpr = %s\n"%( base.localAvatar.getHpr().pPrintValues(),)) - # assert self.debugPrint("handleAvatarControls(task=%s)"%(task,)) + assert self.debugPrint("handleAvatarControls(task=%s)"%(task,)) physObject = self.actorNode.getPhysicsObject() contact = self.actorNode.getContactVector() # get the button states: @@ -576,14 +576,14 @@ class ShipPilot(PhysicsWalker): """ Activate the arrow keys, etc. """ - assert self.debugPrint("enableAvatarControls()") + assert self.debugPrint("enableShipControls()") assert self.collisionsActive if __debug__: #self.accept("control-f3", self.spawnTest) #*# self.accept("f3", self.reset) # for debugging only. - taskName = "AvatarControls-%s"%(id(self),) + taskName = "ShipControls-%s"%(id(self),) # remove any old taskMgr.remove(taskName) # spawn the new task @@ -591,17 +591,17 @@ class ShipPilot(PhysicsWalker): if self.physVelocityIndicator: taskMgr.add( self.avatarPhysicsIndicator, - "AvatarControlsIndicator%s"%(id(self),), 35) + "ShipControlsIndicator%s"%(id(self),), 35) def disableAvatarControls(self): """ Ignore the arrow keys, etc. """ - assert self.debugPrint("disableAvatarControls()") - taskName = "AvatarControls-%s"%(id(self),) + assert self.debugPrint("disableShipControls()") + taskName = "ShipControls-%s"%(id(self),) taskMgr.remove(taskName) - taskName = "AvatarControlsIndicator%s"%(id(self),) + taskName = "ShipControlsIndicator%s"%(id(self),) taskMgr.remove(taskName) if __debug__: