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:
import c4d
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
c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_FORCE_AM_UPDATE))
c4d.EventAdd()
if __name__=='__main__':
main()
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
print btnValue
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?
-ScottA