Remove MTimerMessage / Python API 2.0

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  4 Weeks Ago
Remove MTimerMessage / Python API 2.0

I created a callback with MTimerMessage which shouts out values every 0.04 seconds. Stopping the callbacks works if I call it like that:

om2.MMessage.removeCallback(id)

if I put it in functions for calling it from a window (maya.cmds) it doesn't work:

def cb(elapsedTime,execTime,arg3):
print id

def addCB(*args):
id = om2.MTimerMessage.addTimerCallback(0.04, cb)
return id

def removeCB(*args):
id = addCB()
om2.MMessage.removeCallback(id)

I wondered how to stop it, when it prints out every time a different callback ID
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:27 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.