Python: User Data Float Slider?
-
I create user data with a python script, which works fine.
Now I want to change the appearance of the user data to a Float Slider, at least thats the name of it when I right click it in C4D and choose it underneath User Interface. Can I set it with Python? I'm not able to find the corresponsing call in the Docs, but perhaps I just don't know the correct string to search for.
Please help
# .... define create_null() up here squash_and_stretch_name = "Squash and Stretch" squash_and_stretch_type = c4d.DTYPE_REAL initial_value = 0 min_value = 0.0 max_value = 1.0 step_value = 0.01 user_data_null = create_null("User Data") squash_and_stretch_container = c4d.GetCustomDataTypeDefault(squash_and_stretch_type) squash_and_stretch_container[c4d.DESC_NAME] = squash_and_stretch_name squash_and_stretch_container[c4d.DESC_MIN] = min_value squash_and_stretch_container[c4d.DESC_MAX] = max_value squash_and_stretch_container[c4d.DESC_STEP] = step_value squash_and_stretch_container[c4d.DESC_DEFAULT] = initial_value user_data_null.AddUserData(squash_and_stretch_container)
-
Hello @gaschka,
Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:
- Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
- Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
- Forum Structure and Features: Lines out how the forum works.
- Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.
About your First Question
To set your userdata interface type as a float slider you just need to add c4d.DESC_CUSTOMGUI parameter set to c4d.CUSTOMGUI_REALSLIDER to your userdata container:
squash_and_stretch_container[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_REALSLIDER
It's also a good idea to specify c4d.DESC_MINSLIDER and c4d.DESC_MAXSLIDER when using sliders.
Cheers,
Ilia -
Hi @gaschka ,
I assume that would be percentile value, so you can also add unit, like
squash_and_stretch_container[c4d.DESC_UNIT] = c4d.DESC_UNIT_PERCENT
-