Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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.
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
See how it works in the gif below
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 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 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