Hey Guys,
I'm getting the error " AttributeError: 'GUI' object has no attribute 'AddCheckBox' " in my console, and I believe I'm bringing in the right libraries, I think...But, I cannot seem to find anything that's helping searching through forums and the c4d.gui info pages.
Maxime helped me understand the group concepts so thanks again for that. I commented out a lot of code to test things, but here's the current code that's throwing the error. Still a lot of learning to do, but I've been on this particular error for 2 hours now....oh fun haha
import c4d
from c4d import gui, plugins, bitmaps, documents
class GUI(gui.GeDialog):
""" Creates the main graphical user interface of the plug-in """
ResourceFileGroup = 101
SettingFilegroup = 102
Label_Folders = 201
Label_Settings = 202
Label_ObjectsImport = 203
ResourceFolder = 301
MVRFileLocation = 302
AllCheckBox = 401
HangingPosCheckBox = 402
TrussCheckBox = 403
FixturesCheckBox = 404
GeometriesCheckBox = 405
ComboBox_ID = 1003
AddChild_1 = 1004
TextEdit = 1005
RadioGroup = 1006
RadioText = 1007
RadioChild = 1008
def CreateLayout(self):
self.SetTitle("My Dialog")
self.GroupBegin(self.ResourceFileGroup, 0 | 0)
self.AddStaticText(self.TextEdit, c4d.BFH_SCALEFIT | c4d.BFV_TOP, 100, 25, "Source Files", 1)
self.AddButton(self.ResourceFolder, c4d.BFH_LEFT | c4d.BFV_TOP, 125, 25, "Resource Folder")
self.AddButton(self.MVRFileLocation, c4d.BFH_LEFT | c4d.BFV_TOP, 125, 25, "MVR File")
self.GroupEnd()
self.GroupBegin(self.ResourceFileGroup, 0 | 0)
self.AddStaticText(self.TextEdit, c4d.BFH_SCALEFIT | c4d.BFV_TOP, 100, 25, "Settings", 1)
self.AddCheckBox(self.AllCheckBox, c4d.BFH_LEFT | c4d.BFV_TOP, 125, 25, "All")
self.GroupEnd()
# if self.GroupBegin(self.SettingFilegroup, 0 | 0):
# self.AddStaticText(self.TextEdit, 0 | 0, 100, 25, "Settings", 1)
# self.AddCheckBox(self.AllCheckBox, c4d.BFH_LEFT | c4d.BFV_TOP, 125, 25, "All")
# self.GroupEnd()
# self.SetTitle("CAV MVR IMPORTER") # Set dialog title
# self.AddRadioText(self.Label_Folders, c4d.BFH_LEFT | c4d.BFV_TOP, 0, 0, "Source Files")
# self.AddRadioText(self.Label_Settings, c4d.BFH_CENTER, 0, 0, "Settings")
# self.AddRadioText(self.Label_Settings, c4d.BFH_RIGHT, 0, 0, "Objects To Import")
# self.AddButton(self.ResourceFolder, c4d.BFH_LEFT | c4d.BFV_TOP, 125, 25, "Resource Folder")
# self.AddButton(self.MVRFileLocation, c4d.BFH_LEFT | c4d.BFV_TOP, 125, 25, "MVR File")
# self.AddComboBox(self.ComboBox_ID, 0 | 0, 100, 25, True, True)
# self.AddChild(self.ComboBox_ID, self.AddChild_1, "Drop Down 1")
# self.AddRadioGroup(self.RadioGroup, c4d.BFH_SCALE | c4d.BFV_SCALE, 1, 3)
# Create a Group, its usefull because here we adds the StaticText Gadget and to make it appears again
# LayoutChanged needs to be called, which work only a group.
# if self.GroupBegin(self.TextEditGroup, c4d.BFH_SCALEFIT | c4d.BFV_TOP):
# self.AddStaticText(self.TextEdit, c4d.BFH_SCALEFIT | c4d.BFV_TOP, 100, 25, "", 1)
# self.HideElement(self.TextEdit, True)
# self.GroupEnd()
# def Command(self, id, msg):
# # RESOURCE FOLDER BUTTON
# if id == 201:
# fn_ResourceFolder = c4d.storage.LoadDialog()
# # Unhides the Text element
# self.HideElement(self.TextEdit, False)
# # Checks if its a str, then display the file path
# if isinstance(fn, str):
# # Unhides the Text element
# self.HideElement(self.TextEdit, False)
# # SET THE STRING
# self.SetString(self.TextEdit, fn)
# # If its not a string, the user cancelled
# else:
# self.SetString(self.TextEdit, "User cancelled")
# # Notify the layout of the group changed, this will invalidate the group and it will be then redraw
# # This is needed because the UI was hidden, if the Ui is not hidden then there is no need for it
# self.LayoutChanged(self.TextEditGroup)
# # MVR FILE BUTTON
# if id == 202:
# fn_MVRFileLocation = c4d.storage.LoadDialog()
# # Unhides the Text element
# self.HideElement(self.TextEdit, False)
# # Checks if its a str, then display the file path
# if isinstance(fn, str):
# # Unhides the Text element
# self.HideElement(self.TextEdit, False)
# # SET THE STRING
# self.SetString(self.TextEdit, fn)
# # If its not a string, the user cancelled
# else:
# self.SetString(self.TextEdit, "User cancelled")
# # Notify the layout of the group changed, this will invalidate the group and it will be then redraw
# # This is needed because the UI was hidden, if the Ui is not hidden then there is no need for it
# self.LayoutChanged(self.TextEditGroup)
# print fn_MVRFileLocation
def main():
# Test dialog
diag = GUI()
diag.Open(dlgtype=c4d.DLG_TYPE_MODAL, defaultw=1000, defaulth=400)
# Execute main()
if __name__ == '__main__':
main()
Thanks again for any insight.
Cheers!
MattG