User button test on Python Generator [SOLVED]



  • 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..



  • 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



  • 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.



  • 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



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

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


Log in to reply