Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Help, Userdata Reset to Default Script [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 683 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 01/08/2015 at 17:22, xxxxxxxx wrote:

      Hello,
      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)
      Thanks,
      Regards.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 03/08/2015 at 07:21, xxxxxxxx wrote:

        Hello,

        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:

        • access userdata inside userdata group

        best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 14/08/2015 at 09:04, xxxxxxxx wrote:

          Hello grasycho,

          was your question answered?

          Best wishes,
          Sebastian

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 14/08/2015 at 09:19, xxxxxxxx wrote:

            Hello,

            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.

            Best Regards.

            (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...)

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 15/08/2015 at 07:34, xxxxxxxx wrote:

              Right click parameter then "Reset" or "Reset All"

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 17/08/2015 at 00:28, xxxxxxxx wrote:

                Hello,

                could you explain what exactly is still unclear and what question is still open?

                Best wishes,
                Sebastian

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 17/08/2015 at 06:07, xxxxxxxx wrote:

                  Hello,
                  Thank you for all answers,
                  Yes it's answered.
                  Best Regards.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post