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
    • Recent
    • Tags
    • Users
    • Login

    User button test on Python Generator [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 495 Views
    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.
    • H Offline
      Helper
      last edited by

      On 19/11/2014 at 03:35, xxxxxxxx wrote:

      I can't quite get this to work.  I've figured out how to do button press testing using Tags with code I've seen around the forums - but when I create a button directly on my Python Generator, what goes on inside message() seems different and the usual code doesn't work..

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 20/11/2014 at 11:03, xxxxxxxx wrote:

        Hello,

        can you tell us what code you are using with the Tags? And what kind of "usual code" you are using?

        best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 20/11/2014 at 11:49, xxxxxxxx wrote:

          Hi
          This is the code I used for tags with a user data button on it..

          > def message(id, data) :
          >
          >     if id == 17: 
          >
          >         print "UserData-ID: ", data["descid"][1].id
          >
          > # test for button ID and execute code
          >
          >
          >
          ...but with the same code on a Python Generator the IDs are large numbers, which don't seem anything to do with the button ID.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 21/11/2014 at 02:40, xxxxxxxx wrote:

            Hello,

            when I use your code I have no problem getting the correct user data button ID as defined in the User Data manager. As always I suggest to use the correct identifiers and no magic numbers. The code can look like this:

              
            def message(id,data) :  
                
              if id == c4d.MSG_DESCRIPTION_CHECKUPDATE:   
                
                  # check if button  
                  if data["descid"][1].dtype == c4d.DTYPE_BUTTON:  
                        
                      # get id  
                      buttonID =  data["descid"][1].id  
            

            If the problem persists you could give us some more information about your code and your system.

            best wishes,
            Sebastian

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 21/11/2014 at 03:38, xxxxxxxx wrote:

              Yeah that worked fine for me Sebastian, thank you..

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