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

    GetReal returns 0.0

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 229 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 02/08/2012 at 03:53, xxxxxxxx wrote:

      Hei guys,

      Am I missing something damn obviously here? GetReal(self.EDT_MUL) seems to return 0.0 always.
      Can somebody please enlighten me where the issue is? (Just copy&paste it into the script-manager)
      Thanks,

        
      import c4d  
      import c4d.modules.graphview as c4dgv  
        
      class Dialog(c4d.gui.GeDialog) :  
        
        EDT_MUL = 1000  
        BTN_OK  = 2000  
        BTN_CN  = 2001  
        
        def __init__(self) :  
            super(Dialog, self).__init__()  
            self.ok = False  
        
        def CreateLayout(self) :  
            self.GroupBegin(0, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)  
        
            self.AddStaticText(0, c4d.BFH_LEFT, name="Multiplier")  
            self.AddEditNumberArrows(self.EDT_MUL, c4d.BFH_SCALEFIT)  
        
            self.AddButton(self.BTN_OK, c4d.BFH_SCALEFIT, name="Ok")  
            self.AddButton(self.BTN_CN, c4d.BFH_SCALEFIT, name="Cancel")  
            self.GroupEnd()  
            return True  
        
        def InitValues(self) :  
            self.SetReal(self.EDT_MUL, 0.5, min=0, step=0.01)  
            return True  
        
        def Command(self, id, msg) :  
            if id == self.BTN_OK:  
                self.ok = True  
                self.Close()  
            elif id == self.BTN_CN:  
                self.ok = False  
                self.Close()  
            return True  
        
        def Open(self) :  
            super(Dialog, self).Open(c4d.DLG_TYPE_MODAL, defaultw=200)  
        
        def Succeeded(self) :  
            return self.ok  
        
        def GetResult(self) :  
            return self.GetReal(self.EDT_MUL)  
        
      def main() :  
        dlg = Dialog()  
        dlg.Open()  
        if not dlg.Succeeded() : return  
        
        mul = dlg.GetResult()  
        print mul  
        
        
      if __name__ == "__main__":  
        main()
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 02/08/2012 at 03:57, xxxxxxxx wrote:

        Ah, nevermind. That actually is obviously. One can't retrieve values after the dialog was closed.

          
        import c4d  
          
        class Dialog(c4d.gui.GeDialog) :  
          
          EDT_MUL = 1000  
          BTN_OK  = 2000  
          BTN_CN  = 2001  
          
          def __init__(self) :  
              super(Dialog, self).__init__()  
              self.ok = False  
              self.value = 0.5  
          
          def CreateLayout(self) :  
              self.GroupBegin(0, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)  
          
              self.AddStaticText(0, c4d.BFH_LEFT, name="Multiplier")  
              self.AddEditNumberArrows(self.EDT_MUL, c4d.BFH_SCALEFIT)  
          
              self.AddButton(self.BTN_OK, c4d.BFH_SCALEFIT, name="Ok")  
              self.AddButton(self.BTN_CN, c4d.BFH_SCALEFIT, name="Cancel")  
              self.GroupEnd()  
              return True  
          
          def InitValues(self) :  
              self.SetReal(self.EDT_MUL, self.value, min=0, step=0.01)  
              return True  
          
          def Command(self, id, msg) :  
              if id == self.EDT_MUL:  
                  self.value = self.GetReal(id)  
              elif id == self.BTN_OK:  
                  self.ok = True  
                  self.Close()  
              elif id == self.BTN_CN:  
                  self.ok = False  
                  self.Close()  
              return True  
          
          def Open(self) :  
              super(Dialog, self).Open(c4d.DLG_TYPE_MODAL, defaultw=200)  
          
          def Succeeded(self) :  
              return self.ok  
          
          def GetResult(self) :  
              return self.value  
          
        def main() :  
          dlg = Dialog()  
          dlg.Open()  
          if not dlg.Succeeded() : return  
          
          mul = dlg.GetResult()  
          print mul  
          
          
        if __name__ == "__main__":  
          main()
        

        Cheers,
        -Nik

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