Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Python: User Data Float Slider?

    Cinema 4D SDK
    python 2024
    3
    4
    860
    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.
    • gaschkaG
      gaschka
      last edited by

      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 🙂

      Cinema_4D  2023-12-19 um 18.03.01.png

      # .... 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)
      
      i_mazlovI bacaB 2 Replies Last reply Reply Quote 0
      • i_mazlovI
        i_mazlov @gaschka
        last edited by i_mazlov

        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

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 2
        • bacaB
          baca @gaschka
          last edited by

          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
          
          1 Reply Last reply Reply Quote 2
          • gaschkaG
            gaschka
            last edited by

            @i_mazlov Thank you for the friendly introduction and the hint to CUSTOMGUI and REALSLIDER, exactly what I was looking for.
            @baca Thank you for the additional tip.

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