Hi,
How can I add a button to an object with python?
I'm trying to add a button to a Null Object
, but only get a button userdata without button itself. Here is the code:
import c4d
def main():
null_object = c4d.BaseObject(c4d.Onull)
ud_btn_bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_BUTTON)
ud_btn_bc.SetString(c4d.DESC_NAME, "Click")
ud_btn_bc.SetString(c4d.DESC_SHORT_NAME, "click")
null_object.AddUserData(ud_btn_bc)
doc.InsertObject(null_object)
c4d.EventAdd()
if __name__ == "__main__":
main()
It seems that creating a button user data from GUI is different from Python. But I don't know how to do it correctly in Python.
Thanks!