Hi all,

With the Maya Python API (both 1.0 and 2.0) you can register callbacks,
like so:

from maya.api import OpenMaya as om
om.MDGMessage.addTimeChangeCallback(...)

It’ll hand you an ID you can later use to deregister it.

def myCallback(time, clientData):
   pass

eventId = om.MDGMessage.addTimeChangeCallback(myCallback, None)
om.MMessage.removeCallback(eventId)

But what do you do when you haven’t kept track of the ID? I’m debugging a
potential leak of events being registered but not unregistered and am
looking for something along the lines of..

for func, eventId in om.MMessage.listCallbacks():
  print("EventID %d belongs to %s" % (func, eventId))
# EventID 153 belongs to 'myCallback'

I’m also curious about what events are registered per default and by
third-party plug-ins or scripts and figure this would be an intuitive way
of finding out.

How can I list all currently registered events?

Thanks,
Marcus
​

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODTsq5x7kksAf1rubCmD_yh8LpPrgWHhP1EbWhW_k%2BGbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to