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
    The forum rollback caused push notifications and recent user data to malfunction. The problem will fix itself naturally within the next days. See the topic Broken Push Notifications for a more in detail explanation. You can fix this yourself by forcibly clearing your browser cache (for most browsers: CTRL + F5).

    Python Script Gui: Use EditSlider Get Float

    Cinema 4D SDK
    python
    2
    4
    1.5k
    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.
    • M
      mike
      last edited by

      hello

      i want to use EditSlider in my script to control weight, range (0.00 - 1.00) or other .i search in SDK and use "GeDialog.AddEditSlider(id, flags, initw=80, inith=0)",how can i change the range and get float just like set "user data"?

      thank you!

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @mike, first of all I would like to remind you to read and use the Q&A functionnality.

        Regarding your question, here is an example of a basic GeDialog, which make use to SetFloat to define a range.

        import c4d
        
        class MonDlg( c4d.gui.GeDialog):
            idSlider = 1000
            idButton = 1001
        
            # Create the Layout
            def CreateLayout(self):
                self.AddEditSlider(self.idSlider, c4d.BFH_SCALE|c4d.BFV_SCALE, initw=100, inith=20)
                self.AddButton(self.idButton, c4d.BFH_SCALE|c4d.BFV_SCALE, initw=100, inith=20,name = 'Get Value')	
                return True
        
            # Called after CreateLayout
            def InitValues(self):
                self.SetFloat(self.idSlider, 0.25, min=0.0, max=1.0, step=0.01, min2=0.0, max2=0.0)
                return True
        
            # Called for each interaction from a widget
            def Command(self, id, msg):
                if id == self.idButton:
                    print self.GetFloat(self.idSlider)
                
                return True
        
        def main():
            dlg = MonDlg()
            dlg.Open(c4d.DLG_TYPE_MODAL)
        
        if __name__=='__main__':
            main()
        

        If you have any questions please let me know.
        Cheers,
        Maxime!

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        M 1 Reply Last reply Reply Quote 3
        • M
          mike @m_adam
          last edited by

          @m_adam Thank you for your help!

          1 Reply Last reply Reply Quote 0
          • M
            m_adam
            last edited by

            Hi, @mike if the previous post solves your issue, please mark it as the correct answers. It will switch the topic as solved. To do so please read Q&A functionality.
            Of course, if you didn't test my previous post, or may have follow-up questions, do not mark as solved and take as much time as you need to ask us. But if there is nothing more to add please mark your topic as solved.

            Cheers,
            Maxime

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

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