Solved User data button Python Tag part 2 - No more Notify Messages! Why?

Hello, there!

I know this sounds silly, but it seems like I can't get notify messages any longer despite the fact that my Python Tag is linked to the null. The first example works, the second, which is practically a blank project, does not. Please have a look at the console to see the user data button in action. What am I missing?

Thanks for your time,

Leo

example 1:
User Data Button test.c4d

example 2:
User Data Button - No Notify Messages.c4d

"The idea dictates everything."

by David Lynch

I figured it out.

The missing piece is a listener that's supposed to be added in main(), something like:

def main():

    obj = op.GetObject()
    
    bc = c4d.BaseContainer()
    obj.AddEventNotification(op, c4d.NOTIFY_EVENT_MESSAGE, 0, bc)

The reason why this was not so obvious earlier today is that I read somewhere that there was no need for adding listeners in main(), that I would be adding unnecessary tasks. This is probably my fault, I may have misinterpreted or assumed things from a different context.

But, to my defense, I must say that the code that works has no listeners in it. Have a look!

Well, this is where it gets tricky: the listener code had been there indeed, but I had erased it after a few iterations(because I thought it was overkill).

This means that the listener is still working despite the fact that I had it erased from the Python Tag code, in other words, it's garbage.

I hope this helps other users as well as the Maxon team(you guys rule!)

Thanks for your time,

Leo

"The idea dictates everything."

by David Lynch