PDA

View Full Version : Vizact onupdate events that wont be disabled


Reca
11-03-2011, 05:35 PM
Hey

So my problem is that once i have registered 2 separate onupdate events i cant disable them or remove them.

this is where how i create them:

self.update = vizact.onupdate(viz.PRIORITY_PHYSICS-1, self.UpdateJoystick,viz.getFrameElapsed())
self.postupdate = vizact.onupdate(viz.PRIORITY_PHYSICS+1, self.PostPhysics)

then for disabling and re-enabling them.
def Pause(self):
#vizact.removeEvent( self.update )
#vizact.removeEvent( self.postupdate )
self.update.setEnabled(viz.OFF)
self.postupdate.setEnabled(viz.OFF)
pass

def Resume(self):
#self.update = vizact.onupdate(viz.PRIORITY_PHYSICS-1, self.UpdateJoystick,viz.getFrameElapsed())
#self.postupdate = vizact.onupdate(viz.PRIORITY_PHYSICS+1, self.PostPhysics)
self.update.setEnabled(viz.ON)
self.postupdate.setEnabled(viz.ON)
pass

i have tried to remove them, then re adding them, i have tried to use vizact.removeevent, but that didn't work either, but in the resume function when i recreated them it would double them up, as they werent being removed :(

the pause and resume functions are called by a joypad button press

thanks in for any help you can provide

Jeff
11-16-2011, 05:25 PM
You can use <EventFunction>.setEnabled to enable/disable the callback:
event_handle = vizact.onkeydown(' ',myFunction)
event_handle.setEnabled(viz.OFF)