I'm not sure there is a simple way.
I went looking the last time I was doing serious work with callbacks, and
eventually just settled on wrapping them with my own custom classes that
could handle de-registration as needed.
The closest I could find was `MMessage.nodeCallbacks` which will return a
list of callbacks associated with a node, but that won't track things like
scene, ui, or other non-node based callbacks.
On Monday, April 23, 2018 at 10:06:17 PM UTC-5, Marcus Ottosson wrote:
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/3aa9077b-70c7-4607-a70c-aeeb1a53ee92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.