Sliders in Python plugin
-
Hi,
I'm trying to learn how to write a Python plugin that generates a spline, using the examples you have on Github.
I'm basing it mostly on the "py-double_circle_r19" example.One of the things I'm having issues with is with the custom controls.
I can add them, for example like this in the .res file:REAL PYROUNDRECT_HEIGHT { UNIT METER; MIN 0.0; } REAL PYROUNDRECT_WIDTH { UNIT METER; MIN 0.0; }
but they only have a text box, no slider. How do I add sliders to them?
Thank you.
-
@filipst example:
REAL PYROUNDRECT_HEIGHT { UNIT METER; MIN 0.0; CUSTOMGUI REALSLIDER;}
-
Thank you, it works!
Another question if you don't mind. What's the best/recommended way to limit one of these values based on other values?
For example, like how the corner radius on the Rectangle spline that comes with C4D is limited by the width or height of the rectangle?
Where in the plugin would the code for this go? -
Hello @filipst,
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
As @chuanzhen absolutely rightly pointed out, you can find the list of available description element types on the corresponding documentation page: Description Resource. Please note that some parts of documentation are better available on C++ category even though also related to Python workflow.
Let me know if you have any further questions.
Cheers,
Ilia -
Hello @filipst,
Without further questions or updates we will consider this topic as solved by Friday the 11th, and flag it accordingly.
Cheers,
Maxon SDK Group