On 07/05/2014 at 07:58, xxxxxxxx wrote:
I don't understand why you can't get it's value just like any other UserData gizmo?
This script that will create a UD button to an object:
def main() :
obj = doc.GetFirstObject()
if not obj: return False
bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_BOOL) #Create the default container
bc.SetString(c4d.DESC_NAME,"Click Me") #The text on the button
bc.SetLong(c4d.DESC_CUSTOMGUI,c4d.CUSTOMGUI_BUTTON) #Sets the bool gizmo to be a button
button = obj.AddUserData(bc) #Add the userdata to the object
obj[button] = False #Assign a default value to it when it created
To get it's value this should be all you need to do.
#Since the button gimzo was the first UD item created
#It has a level ID #1
btnValue = obj[c4d.ID_USERDATA,1] #<---Returns true/false depending on the button's click state
Each new button should have it's own level#.
So you just use that number instead of #1 in the code for getting the value of the other buttons.
Are you doing something different than this Rui?