On 01/08/2015 at 17:22, xxxxxxxx wrote:
I'm building formula spline profiles with userdata controls. Some of formulas are too complicated and after a while user may want to reset them with a reset button in userdata. I have searched and find some xpresso examples but they are slow because it's running inside xpresso constantly. So I have decided to use python (using python node already for formulas)
Default userdata values are stored in UD. Is there snippet or short script to do that inside Python Node?
If there is no way to reset to default values I might enter those values manually but my question is mostly related how to build a button inside python node that runs only for once. Checkbox would be great for users who has previous version of C4D.
And lastly if it's not possible inside Python Node I can still use as Python Tag.
(P.S. I'm a very beginner in Python)
On 03/08/2015 at 07:21, xxxxxxxx wrote:
the Python Xpresso node should typically be used to perform numerical calculations or to apply conditions. It should not be used to access and change objects in your scene directly or to react to user interaction (but you could of course use an Object node and connect the out-ports of the Python node the that node's input ports). It is not the purpose of a Python Xpresso node to only run once.
Also, the Python Tag is typically used to change the host object every time the scene is calculated.
So it seems to me that maybe the most simple way to do what you want is to use a script that is stored in and executed from the Script Manager.
To reset a user data parameter you have to access the default value that is stored in DESC_DEFAULT. You find some example of that in this thread:
On 14/08/2015 at 09:04, xxxxxxxx wrote:
was your question answered?
On 14/08/2015 at 09:19, xxxxxxxx wrote:
Thank you but it's not answered, since I'm a beginner in python I could not exactly understand codes in links about related threads. All I need is a simple button for to reset all default settings in userdata. I don't need to access specific userdata ID. And when we create an userdata we assing default value no? I only need to reset this value.
(By the way : It would be great to have Cinema 4D Python book with lots of examples. I'd gladly like to buy it online...)
On 15/08/2015 at 07:34, xxxxxxxx wrote:
Right click parameter then "Reset" or "Reset All"
On 17/08/2015 at 00:28, xxxxxxxx wrote:
could you explain what exactly is still unclear and what question is still open?
On 17/08/2015 at 06:07, xxxxxxxx wrote:
Thank you for all answers,
Yes it's answered.