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_m...@googlegroups.com.
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.
But, even if you could get a list of ids, what would you do with them?
I just need to tell whether they are growing in numbers or not. To help with debugging.
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.
Mm, I do this too, and they probably aren’t the problem, I’m just trying to make sure. How odd there wouldn’t be a registry of sorts. Who knows how many callbacks are running, could come from anywhere, especially the more complex scripts, frameworks and plug-ins.
Thanks anyway guys, and if someone is reading this from the future, do chime in with the solution!
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
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.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3szE_D%3DsbzMoAdUm0Rihn7sm9hk_MJk-N4M%2B_tPgpPXw%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
I use MCallbackIdArray, and loop over it to delete the callbacks , or even better you can pass the array for that...
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1348d863-fdce-4532-98d0-b60b5672d577%40googlegroups.com.
Sorry I misunderstood the question , dude on stackoverflow says no : https://stackoverflow.com/questions/46896907/open-maya-callbacks-in-python-or-c-query-all-callbacks-in-memory , and as suggested it makes no sense to show it to clients, because they’d try to kill it and open a black hole , even if internally the id could be recognize it will be unmaintainable for the devs
Sent from Mail for Windows 10
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/dap89EvycNA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0uSP8zVsGRXorJ8QJq1nA_5iES2A1q7EyABApEgSj-Fw%40mail.gmail.com.