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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to hide or disable user data description elements

    Cinema 4D SDK
    python s24 windows macos
    2
    2
    475
    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.
    • ThomasBT
      ThomasB
      last edited by ferdinand

      sorry @Ferdinand if I annoy you again,

      but is it possible, for example, in a Python Generator that has a small user data interface, e.g. to change the name of a user data entry or to hide it or set editable to False, so that I can no longer change the value of it , I mean is it feasable with the code in the Python Generator to change this dynamically, not with script. So to change the data descriptions, I have problems with access.

      like here in the picture:
      The Boolean above, if true, then the entry should change from "steps" to "Big Steps" or it should hide it or that it is no longer editable.

      8c4c72c2-fe0f-45c7-a924-2a10fc13c20d-image.png

      and also is it possible to change completely the interface when the bool is on True, maybe instead of the real value , to set a Data Type Link .
      Or do I have then delete the Userata and add a new one?
      Or via PlugIn but Plugin is so difficult , I first have to study a bit plugin code...all these classes what they are for...man it is frustrating 😵

      Thanks,
      T.S.B

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @ThomasB
        last edited by ferdinand

        Hello @thomasb,

        thank you for reaching out to us. Please remember to open a new thread for new questions of yours. It is fine to ask follow-up questions in a topic, but when the threshold to a new topic is being crossed, a new thread should be opened. I have done this for you here.

        In principle this is at least partially possible. You can determine the visibility for a user data description element with the description field DESC_HIDE, see example at the end of the posting for details. It is not possible to gray-out, i.e., disable, user data description elements. It is also a bit a case of an unusual workflow for user data, since you would have to rebuild the user data container every time you want to hide or show and element in it. You could overwrite for example message() in a Python scripting tag and then react to when a user clicks a button, drags a slider, etc. in the user data and rebuild the user data based on that. Which would give you the dynamic GUI feeling you are probably after. I have done this in the past, but more as a hack for fun to see how far I can push user data. I would not recommend doing it as it will complicate things like animation and can lead to "janky" interfaces. Being bound to the execution order of expressions can also lead to problems.

        If you want dynamic GUIs, you should implement a plugin. There you can overwrite NodeData.GetDDescription() to modify the description, e.g., add, remove, or hide stuff. To disable stuff, i.e., gray it out, you must overwrite NodeData.GetDEnabling().

        Cheers,
        Ferdinand

        """Example for adding a hidden user data element.
        """
        
        import c4d
        
        def main():
            """Adds a hidden check box and a visible integer element to the user
            data of the selected object. 
            """
            if op is None:
                raise ArgumentError("Please select an object for running this script.")
        
            datenDesc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_BOOL)
            datenDesc[c4d.DESC_NAME] = "Daten"
            datenDesc[c4d.DESC_HIDE] = True # Element will be hidden
        
            stepsDesc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG)
            stepsDesc[c4d.DESC_NAME] = "steps"
            stepsDesc[c4d.DESC_HIDE] = False # Element will be visible
        
            op.AddUserData(datenDesc)
            op.AddUserData(stepsDesc)
        
            c4d.EventAdd()
        
        if __name__ == '__main__':
            main()
        

        MAXON SDK Specialist
        developers.maxon.net

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