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

    Cinema4D GeDialog Not Updating.

    Cinema 4D SDK
    python
    2
    3
    440
    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.
    • E
      EAZY5D
      last edited by EAZY5D

      Dear Developers,

      So I have this Class for a dynamic settings and help interface which works fine see code below. Here are the list of what is not included

      Emm Code works for all versions from R21 - S25 Tested

      1. I have a .ini file which I read from with a fuction called loadSettings()
      2. A replace() fuction which I use to save setting's back to the .ini file
      3. a Fuction Called SMsg() which contain' s the message I pass to the replace() for any new message

      See how it works in the gif below

      oslJcMFyOe.gif

      it does just that it all works see the code below, After code contains the problem pls scroll down

      # ID's
      
      # 1. Main Group That Holds ALl The Other Grooups
      ID_MAINGROUP2 = 19000
      ID_SUBMAIN = 19500
      # 2.LeftBox Group and CheckBox
      LB_GROUP = 3000
      LB_USE_CUSTOM_COLOR = 3001
      LB_TOGGLE_GLOW = 3002
      # 3.RighBox Group and COMBObox
      COMBO_GROUP = 4000
      COMBO_BOXID = 4003
      COMBO_USE_ASV = 4004
      COMBO_USE_ARV = 4005
      # 4. Info
      INFO_GROUP = 5000
      INFO_TEXTF = 5001
      
      # Ok/Cancle
      BTN_GROUP = 7000
      BTN_OK          = 7001
      BTN_CANCEL      = 7002
      # End of ID's
      class Settings_Gem(gui.GeDialog):
          """docstring for Settings"""
          def __init__(self):
              super(Settings_Gem, self).__init__()
              self.res = c4d.BaseContainer()
      
          def InitValues(self):
              print ("Refreshing GUI")
              defaultMSG, Msg1, Msg2, Msg3, Msg4 = SMsg()
              self.AppendGuiHelp(defaultMSG)
              return True
      
          def AppendGuiHelp(self, msg):
      
              replace(1, msg)
      
              # Flush the content of the group that holds all ours SubDialogs
              self.LayoutFlushGroup(INFO_GROUP)
      
              self.AddMultiLineEditText(INFO_TEXTF, c4d.BFH_SCALEFIT, inith=50, initw=500,
                                        style=c4d.DR_MULTILINE_READONLY | c4d.DR_MULTILINE_WORDWRAP)
      
              self.GroupEnd()
              # GUISettings,Camera,Comp,Focal,Toggle = loadSettings()
              GUISettings = loadSettings()
              txt = str(GUISettings["setINFO"])
              txtfix = (txt.format("\n"))
              self.SetString(INFO_TEXTF, txtfix)
              # Notifies the content of the MainGroup has changed
              self.LayoutChanged(INFO_GROUP)
      
              return True
          def CreateLayout(self):
              bc = c4d.BaseContainer() # Initialize a base container
              self.SetTitle("Settings For SetCamS") # Set dialog title
              # ----------------------------------------------------------------------------------------
              self.GroupBegin(ID_MAINGROUP2, c4d.BFH_LEFT, 1, 2)
              self.GroupBorderSpace(5, 5, 5, 5)
              # ----------------------------------------------------------------------------------------
              self.GroupBegin(ID_SUBMAIN, c4d.BFH_FIT | c4d.BFH_LEFT, 4, 1)
              # self.GroupBorderSpace(5, 5, 5, 5)
              # self.GroupBorderNoTitle(c4d.BORDER_ACTIVE_3)
      
              # Check Box On Left
              self.GroupBegin(LB_GROUP, c4d.BFH_LEFT, 1, 1, "")
              self.GroupBorderNoTitle(c4d.BORDER_ACTIVE_4)
              self.GroupBorderSpace(5, 5, 5, 5)
              self.AddCheckbox(LB_USE_CUSTOM_COLOR, c4d.BFH_LEFT, 0, 13, "Use Custom Color")
              self.AddCheckbox(LB_TOGGLE_GLOW, c4d.BFH_LEFT, 0, 13, "Last Used Show Glow")
              self.GroupEnd()
      
              # Check Box On Right
              self.GroupBegin(COMBO_GROUP, c4d.BFH_RIGHT, 2, 1, "Cam Mode")
              self.GroupBorder(c4d.BORDER_ACTIVE_4)
              self.GroupBorderSpace(25,13, 25, 13)
              self.AddComboBox(COMBO_BOXID, c4d.BFH_RIGHT, 140, 13)
              self.AddChild(COMBO_BOXID, COMBO_USE_ASV, "Use ASV")
              self.AddChild(COMBO_BOXID, COMBO_USE_ARV, "Use ARV")
              self.GroupEnd() # End 'Alt' group
      
              self.GroupEnd()
      
              # Creates a group that will contain all the group representing each tab
              # self.GroupBegin(ID_MAINGROUP, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0, '', 0)
              # self.GroupEnd()
      
              self.GroupBegin(INFO_GROUP, c4d.BFH_RIGHT, 2, 1, "INFO")
              self.GroupBorder(c4d.BORDER_ACTIVE_4)
              self.GroupBorderSpace(5, 3, 5, 3)
      
              self.AddMultiLineEditText(INFO_TEXTF, c4d.BFH_SCALEFIT, inith=50, initw=500,
                                        style=c4d.DR_MULTILINE_READONLY | c4d.DR_MULTILINE_WORDWRAP)
              # self.SetString(INFO_TEXTF,
              #     "Pls Read!!! \nThis Shows You What Each Setting you Clicked On is Used For."
              #     "\nDon't Ask Why! :| I Am Real Bad At Naming Sh*&"
              #     "\n\nHold CTRL and Run the Script to Ignore All Selected Camera Obj(s), This will Apply any SetCam Script Settings to you C4D Default Camera\n"
              #     "The Default Camera Selected is Based on the ASV/ARV in the Settings GUI.")
      
              self.GroupEnd()
      
              self.GroupBegin(BTN_GROUP, c4d.BFH_CENTER, 0, 0, "OK to SaVe Settings") # Begin 'Buttons' group
              self.GroupBorder(2)
              self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL)
              self.GroupEnd()
      
              # Set Defaults
              GUISettings = loadSettings()
              # GUISettings,Camera,Comp,Focal,Toggle = loadSettings()
              txt = str(GUISettings["setINFO"])
              txtfix = (txt.format("\n"))
              self.SetString(INFO_TEXTF, txtfix)
              self.SetInt32(LB_USE_CUSTOM_COLOR,    int(GUISettings['setC_Color']))
              self.SetInt32(LB_TOGGLE_GLOW,     int(GUISettings['setT_Glow']))
              self.SetInt32(COMBO_BOXID,    int(GUISettings['setCOMBO']))
      
      
              return True
      
          def Command(self, id, msg):
              bc = c4d.BaseContainer() # Initialize a base container
              defaultMSG, Msg1, Msg2, Msg3, Msg4 = SMsg()
      
              #####################
              # Save, Cancle, Esc #
              #####################
              C_Color = int(self.GetInt32(LB_USE_CUSTOM_COLOR)) # Get color
              T_Glow  = int(self.GetInt32(LB_TOGGLE_GLOW)) # Get glow
              Combo   = int(self.GetInt32(COMBO_BOXID)) # Get Camera COMBO
      
              c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_ESC, bc)
              if bc[c4d.BFM_INPUT_VALUE]:
                  print("User Click on ESC")
                  self.Close()
                  return True
      
              # User click on Ok button
              if id == c4d.DLG_OK:
                  print("User Click on Ok")
                  saveSettings(C_Color, T_Glow, Combo)
                  self.Close()
                  return True
      
              # User click on Cancel button
              elif id == c4d.DLG_CANCEL:
                  print("User Click on Cancel")
                  # Close the Dialog
                  self.Close()
                  return True
      
              # print (id)
      
              ############################
              # Staring To Write to File #
              ############################
              if id == LB_USE_CUSTOM_COLOR:
                  print ("Settings CustomCOlor")
                  self.AppendGuiHelp(Msg1)
                  return True
      
              if id == LB_TOGGLE_GLOW:
                  print ("Settings ToggleGlow")
                  self.AppendGuiHelp(Msg2)
                  return True
      
      
      
              if id == COMBO_BOXID:
                  if Combo == COMBO_USE_ASV:
                      print ("Settings ASV")
                      self.AppendGuiHelp(Msg3)
                      return True
      
                  elif Combo == COMBO_USE_ARV:
                      print ("Settings ARV")
                      self.AppendGuiHelp(Msg4)
                      return True
      
                  else:
                      print ("WHF")
                      self.AppendGuiHelp("Hahaha open a Fucking")
      
      
              return True
      
      diag = Settings_Gem()
              diag.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, 0, -2, -2, 200, 45) # Open dialog
      

      Problem, Now I made a simple popUp dialog and joUMzyDIOO.png copy pasted the Settings class just as it is and called it

      if result == Settings_id:
                  diag = Settings_Gem()
          
                  diag.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, 0, -2, -2, 200, 45) # Open dialog
      

      And It's a disaster sometimes I get a
      SystemError: error return without exception set "Which is Fustrating"
      or worse See gifanJ0CAEgZK.gif

      The whole thing just Falls Apart I would have pasted the whole code but it's like 2k line plus since it a completion of multiple Things all in one. 😥

      Ohh and the .ini File does update only the Gui in cinema4D does not

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

        Hello @eazy5d,

        welcome to Plugin Café and the Cinema 4D development community. Thank you for reaching out to us.

        We are having some troubles answering your question, since neither your code is executable (I can see that the import statements and the registration calls for your CommandData are missing for example) nor is your problem description 'And It's a disaster sometimes I get a SystemError: error return without exception set "Which is Fustrating"' fully clear to me. So, you mean an exception is being raised without a callstack or what does 'SystemError: error return without exception set' mean? Without any line-numbers it is hard to unpack that. Which would make executable code important.

        So, we would ask you to provide the full content of your '*.pyp' file, so that we can test your plugin ourselves. It would also be good, if you could provide a short description of what actions lead to your problem. I think you did intended to describe that with an image, but the image below 'or worse See gif` seems to be the same as the first one you did post and at least for me does not bear any indication on what is going wrong.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • E
          EAZY5D
          last edited by

          Thanks for your prompt Reply, I was able to debug the whole thing yesterday, I don't know what to do with this post now though.

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