How to use the new UserData Button?

On 27/09/2014 at 14:35, xxxxxxxx wrote:

Hello everybody,

does anyone know how to work with the new UserDat Buttons?


On 13/10/2014 at 02:37, xxxxxxxx wrote:

I would like to know this too 🙂

On 13/10/2014 at 05:39, xxxxxxxx wrote:


from the plugin side it could be set and used like this:

def AddUserdata(self,op) :  
  rootGroup = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP)  
  rootGroup[c4d.DESC_NAME] = "Button_Group"  
  rootGroup[c4d.DESC_SCALEH] = False  
  rootGroup[22] = 2 #two colums  
  rootGroup[c4d.DESC_PARENTGROUP] = c4d.DescID(0)   
  button= c4d.GetCustomDatatypeDefault(c4d.DTYPE_BUTTON)  
  button[c4d.DESC_NAME] = "BUTTON"  
  button[c4d.DESC_PARENTGROUP] = op.GetUserDataContainer()[0][0]  
def Message(self, node, type, data) :  
      if type== c4d.MSG_MENUPREPARE:  
      if (type == c4d.MSG_DESCRIPTION_COMMAND) :   
          id = data['id'][0].id  
          if(id == 700) :  
              print id  
              print data  
              print "button pressed"  


On 13/10/2014 at 05:52, xxxxxxxx wrote:


Thanks for the reply. 
Is there a way to get to the button in a python tag, like with other user data?

I tried:

print op.GetObject()[c4d.ID_USERDATA,1]

in a python tag, but that returns None

On 14/10/2014 at 01:14, xxxxxxxx wrote:

unfortunatly I don´t have a solution for this.

It seem´s logical to me that op.GetObject()[c4d.ID_USERDATA,1] does´nt work.
A button message is´nt the same, as a stored ud value.

It´s indeed interesting how to handle this.


On 14/10/2014 at 01:32, xxxxxxxx wrote:

+1 on the interested to use this in a scripting context.

On 14/10/2014 at 06:05, xxxxxxxx wrote:

I think I may have figured out where the buttons are meant to be used. The new 'Interaction tag" in R16 has a message function you can activate and I managed to get it to give me consistent numbers when using UserData button presses.

def message(id, data) :
    if id == 18: # Don't know why 18 yet :(
        for i in data['msg']: #seems to be the consistently changing thing
            print i[c4d.DESC_NAME] #the number stays [c]( aligning with different button presses

Let me know if anyone has more light to shed.



On 15/10/2014 at 14:36, xxxxxxxx wrote:

It seems we are able to use message function in python tag now.
PythonTag with UserDataButton and following lines...

import c4d  
#Welcome to the world of Python  
def message(id, data) :  
  if id == 17:   
      print "UserData-ID: ", data["descid"][1].id  
def main() :  
  pass #put in your code here

On 15/10/2014 at 23:56, xxxxxxxx wrote:


thank you both Adam and rown.
For the idea and the proper solution at the end.

This works!

Best wishes

On 16/10/2014 at 00:34, xxxxxxxx wrote:

Many thanks!

On 16/10/2014 at 01:47, xxxxxxxx wrote:

#define MSG_DESCRIPTION_CHECKUPDATE               17 ///< Allows elements to determine the type of refresh after a parameter has been changed in the Active manager.  
#define MSG_DESCRIPTION_COMMAND                   18 ///< Sent by for example @em BUTTON description element. @correspondingData{DescriptionCommand}
id == 17 - rown, you simply check out dirty of gui?! But if udata is at pyTag...  
if udata at host op( _op.GetObject()_ ), thats question.  
I tried through c4dAtom.Message...freeze c4d or got shutdown  

On 17/08/2015 at 08:48, xxxxxxxx wrote:

Just for completeness, in this thread there's now a more complete example, how to use User Data buttons in the Interaction Tag.