Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

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

    Cinema 4D SDK
    python r19
    1
    2
    536
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Leo_SaramagoL
      Leo_Saramago
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • Leo_SaramagoL
        Leo_Saramago
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post