[Maya API] MMessage.currentCallbackId()

Heads up for anyone trying to use the “currentCallbackId()” function from the MMessage class in the Maya Python API. It works in the Python API 2.0, but not in the original Python API.

In the original Python API, I have a list of callback IDs, where each one is something like <PyCObject object at 0x000000001D80AFA8>. The “currentCallbackId()” function also returns a PyCObject. But it does not match any of the callbacks in my list. Also, “currentCallbackId()” seems to return the same value every time. I suspect that it is just giving me the memory address of the result, and it just uses the same address over and over, since it frees the memory when it goes out of scope.

The Python API 2.0 returns the IDs as long integers. So you can actually compare the values successfully.

(Admittedly, I don’t really understand PyCObjects. So if someone knows a way to get the underlying callback ID, please let everyone know. I couldn’t find any other posts about this issue anywhere.)