Boolean Button User Data [SOLVED]

On 13/12/2016 at 09:25, xxxxxxxx wrote:

Hello there,

Is it possible to create a boolean button user data with python as in the screenshot below:

C4D File : boolean_button.c4d

Also, is it possible to copy user data from one object to another using python?

Thanks.

On 14/12/2016 at 00:37, xxxxxxxx wrote:

Have look at this thread https://plugincafe.maxon.net/topic/7277/8420_special-options--creating-userdata-with-python
You got everything you need about creating / copy UD

And you can also read this tutorial for a better understanding http://www.grooff.eu/tutorials/Adding User Data using Python.pdf

On 14/12/2016 at 01:15, xxxxxxxx wrote:

Hello,

it seems one can create such a boolean button by creating a boolean user data parameter and using the custom GUI of a button:

  
bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_BOOL)  
bc.SetString(c4d.DESC_NAME, "Button")  
bc.SetInt32(c4d.DESC_CUSTOMGUI, c4d.CUSTOMGUI_BUTTON)  
  
op.AddUserData(bc)  
  
c4d.EventAdd()  

You find the functions to handle user data in the description of the BaseList2D class.

best wishes,
Sebastian

On 14/12/2016 at 14:31, xxxxxxxx wrote:

Hello,

Thanks so much for your replys, thats works the boolean button.

I have a new problem : I wanted to add a Font Data Type but I dont know how to do that. i have checked in this list : c4d.GetCustomDataTypeDefault() but I don't found the font data type.

Thanks again.

On 14/12/2016 at 17:41, xxxxxxxx wrote:

https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/CustomDataType/FontData/index.html

I guess it's that but not sure 😉

On 15/12/2016 at 02:26, xxxxxxxx wrote:

Hi,

Here's how to simply create a FontData user data:

import c4d
  
bc = c4d.GetCustomDatatypeDefault(c4d.FONTCHOOSER_DATA)
bc[c4d.DESC_NAME] = 'FontUserData'
bc[c4d.DESC_SHORT_NAME] = 'FontUD'
  
op.AddUserData(bc)
c4d.EventAdd()

To enable the font size popup:

bc[c4d.FONTCHOOSER_ENABLE_SIZE] = True

On 16/12/2016 at 07:14, xxxxxxxx wrote:

Thank you guys for your help.