On 16/09/2015 at 10:54, xxxxxxxx wrote:
hi Andreas Block and sorry again , hey try it but it dont work I am now lost now but take a look at where i put it.
class SelectedObjectExporterDialog(c4d.gui.GeDialog) : #<-------Main Dialog for the Plugin----#
#--------------------------------------------#
#_____ Interface Layout______________________________________________________#
LOGO = BANNER()
def CreateLayout(self) :
self.SetTitle("Selected Object Exporter v0.1") # <-------------My Title for the MAIN Dialog------
#The Menu for top part of Interface_____(About)-(Check for Updates)_________#
self.MenuFlushAll()
self.MenuSubBegin("About")
self.MenuAddString(ABOUT["id"], ABOUT["name"])
self.MenuSubEnd()
self.MenuFinished()
self.MenuSubBegin("Check for Updates")
self.MenuAddString(Check_for_Updates["id"], Check_for_Updates["name"])
self.MenuSubEnd()
self.MenuFinished()
#---This is were Your Plugin Image Group Go!------------------------------------------------------------------>
self.GroupBegin(0, c4d.BFH_CENTER | c4d.BFV_CENTER, cols=1)
self.GroupBorderNoTitle(c4d.BORDER_NONE)
self.GroupBorderSpace(0, 0, 0, 0)
self.AddUserArea(1, c4d.BFV_CENTER | c4d.BFV_CENTER)
self.AttachUserArea(self.LOGO, 1)
self.GroupEnd()
self.AddSeparatorH(200, flags=c4d.BFH_SCALEFIT)
self.AddStaticText(0, c4d.BFH_CENTER, 0, 0, "|<| Welcome to SELECTED OBJECT EXPORTER |>|", 0) # <-------------My title ------
self.GroupBegin(20007, c4d.BFH_FIT | c4d.BFH_SCALEFIT, 1, 0, "") # <------------|
self.AddSeparatorH(200, flags=c4d.BFH_SCALEFIT) # Adding Separator lol ,thats how I put it. AND I use it Aot.
self.GroupEnd()
#_____PART OF EXPORT Tab __________Quick Selected Exporter_________________________________________________#
self.GroupBegin(20078, c4d.BFH_SCALEFIT | c4d.BFV_BOTTOM, 1, 0, "")
self.Only_Obj = self.AddCheckbox(Selected_1, c4d.BFH_LEFT, 250, 0, "Selected Object Only")
self.SetBool(Selected_1, True)
self.AddSeparatorH(200, flags=c4d.BFH_SCALEFIT)
self.GroupBegin(20078, c4d.BFH_SCALEFIT | c4d.BFH_CENTER | c4d.BFV_BOTTOM, 2, 0, "| Select Format |")
self.GroupBorder(c4d.BORDER_GROUP_IN)
self.AddStaticText(0, c4d.BFH_LEFT, 100, 0, " FORMAT :")
self.format_list = self.AddComboBox(Exporter_Button, c4d.BFH_SCALEFIT, 46, 0, False) # <----- DROP MENU using a ComboBox and in the list that is (AddChild) .
self.AddChild(Exporter_Button, DAE_1_4, 'COLLADA 1.4 (*.dae)')
self.AddChild(Exporter_Button, FBX_ALL, 'FBX (*.fbx)')
self.AddChild(Exporter_Button, W_Obj, 'Wavefront (*.obj)')
self.AddChild(Exporter_Button, thee_Ds, '3D Studio (*.3ds)')
self.AddChild(Exporter_Button, Direct_3D, 'Direct 3D (*.x)')
self.AddChild(Exporter_Button, Alembic_abc, 'Alembic (*.abc)')
self.AddChild(Exporter_Button, COLLADA_15, 'COLLADA 1.5 (*.dae)')
self.AddChild(Exporter_Button, Illustrator_AI, 'Illustrator (*.ai)')
self.AddChild(Exporter_Button, STL_stl, 'STL (*.stl)')
self.AddChild(Exporter_Button, Dxf_DXF, 'DXF (*.dxf)')
self.AddChild(Exporter_Button, 123349, '-----------------------')
self.AddChild(Exporter_Button, 123346, 'MDL (*.MDL) Flight Sim Model')
self.GroupEnd()
self.AddSeparatorH(250, flags=c4d.BFH_SCALEFIT)
self.GroupBegin(20078, c4d.BFH_SCALEFIT | c4d.BFV_BOTTOM, 2, 0, "")
self.AddStaticText(0, c4d.BFH_LEFT, 240, 0, " Model Project Scale. . . . . . . . . . . . .")
self.format_list2 = self.AddComboBox(Exporter_Button2, c4d.BFH_SCALEFIT, 50, 0, False)
self.AddChild(Exporter_Button2, ID_CM, 'Centimeters')
self.AddChild(Exporter_Button2, ID_M, 'Meters')
self.AddChild(Exporter_Button2, 10034, 'Kilometers')
self.AddChild(Exporter_Button2, 10034, 'Millimeters')
self.AddChild(Exporter_Button2, 10034, 'Miles')
self.AddChild(Exporter_Button2, 10034, 'Yards')
self.AddChild(Exporter_Button2, 10034, 'Feet')
self.AddChild(Exporter_Button2, 10034, 'Inches')
self.GroupEnd()
self.AddButton(UI_BT_Export, c4d.BFH_SCALEFIT | c4d.BFV_BOTTOM , 100, 20, "EXPORT MODEL >>>")
self.GroupSpace(200, 5)
self.GroupEnd()
self.GroupEnd()
self.GroupBegin(20078, c4d.BFH_SCALEFIT | c4d.BFV_BOTTOM, 1, 0, "")
self.AddSeparatorH(200, flags=c4d.BFH_SCALEFIT)
self.AddStaticText(0, c4d.BFH_CENTER, 0, 10, "<<<<[-A Part of C4D|2|light SIM SDK-]>>>>", 0)
self.AddSeparatorH(200, flags=c4d.BFH_SCALEFIT)
self.AddButton(ID_Updates_BT, c4d.BFH_RIGHT, initw=180, name="Check for Updates")
self.AddSeparatorH(200, flags=c4d.BFH_SCALEFIT)
#self.AddStaticText(0, c4d.BFH_CENTER, 0, 10, "<<<-------------<[-QuantumDrop Studios-Copyrights 2015-]>----------->>>", 0) # for When Its Ready to go!
self.GroupEnd()
if self.readSettings() == False:
self.SetLong(self.format_list, Exporter_Button)
self.SetLong(self.format_list2, Exporter_Button2)
return True
############### End of Layout #################################
#--------------------------------------------#
####### The Set State of the Layout Interface#######________________________#
def InitValues(self) :
self.SetLong(Exporter_Button, Exporter_Button) #Sets the combobox to the first option when plugin opens
self.SetLong(Exporter_Button2, ID_CM)
self.UpdateDlg(self.GetLong(Exporter_Button))
self.UpdateDlg(self.GetLong(Exporter_Button2))
return True
#-------------------------------------------------------------------------------------------------#
#_E.X.P.0.R.T__F.O.R.M.A.T.S________________________________________________________#
###-FORMATS FUNCTION For Commands -#######################
#####_M.E.T.E.R.S_(ID_M)#####
def DAE_1_4_Format_M(self) :
objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
if objs == None:
return
docTemp = c4d.documents.IsolateObjects(doc, objs)
if docTemp == None:
return
# Set project scale
unitScale = c4d.UnitScaleData()
unitScale.SetUnitScale(1.0, c4d.DOCUMENT_UNIT_M)
bc = c4d.BaseContainer()
bc[c4d.DOCUMENT_DOCUNIT] = unitScale
docTemp.SetDocumentData(c4d. DOCUMENTSETTINGS_DOCUMENT, bc)
#c4d.CallCommand(100004821, 100004821) # Paste
#c4d.CallCommand(60000, 5) # Export Filter for DAE 1.4 in R16 and r17
c4d.documents.KillDocument(docTemp)
return True
def Three_DS_Format_M(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000032, 600000032) # PS_M_id
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 11) # Export Filter 3ds
c4d.CallCommand(12664, 12664) # Close
return True
def FBX_Format_M(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000032, 600000032) # PS_M_id
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 9) # Export Filter
c4d.CallCommand(12664, 12664) # Close
return True
def OBJ_Format_M(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000032, 600000032) # PS_M_id
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 14) # Export Filter - obj
c4d.CallCommand(12664, 12664) # Close
return True
#-----------------------------------------------
###########_C.E.N.T.I.M.E.T.E.R.S_(ID_CM)###################
def DAE_1_4_Format_CM(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000031, 600000031) # PS_CM_id[10601]
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 5) # Export Filter for DAE 1.4 in R16 and r17
c4d.CallCommand(12664, 12664) # Close
self.Close()
return True
def Three_DS_Format_CM(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000031, 600000031) # PS_CM_id[10601]
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 11) # Export Filter 3ds
c4d.CallCommand(12664, 12664) # Close
return True
def FBX_Format_CM(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000031, 600000031) # PS_CM_id[10601]
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 9) # Export Filter
c4d.CallCommand(12664, 12664) # Close
return True
def OBJ_Format_CM(self) :
c4d.CallCommand(100004820, 100004820) # Copy
c4d.CallCommand(12094, 12094) # New
c4d.CallCommand(600000031, 600000031) # PS_CM_id[10601]
c4d.CallCommand(100004821, 100004821) # Paste
c4d.CallCommand(60000, 14) # Export Filter - obj
c4d.CallCommand(12664, 12664) # Close
return True
#_T.H.E__C.O.M.M.A.N.D.S__F.U.N.C.T.I.O.N.S___________________________________________________________________________________________________________________________#
def Command (self, id, msg) :
if id == UI_BT_Export:
if self.GetLong(10010)==ID_M: #<-------| if meters Check in the ComboxBox then excute the formats in the following of Meters List|
if self.GetLong(10004)==DAE_1_4:
self.DAE_1_4_Format_M()
if self.GetLong(10004)==thee_Ds:
self.Three_DS_Format_M()
if self.GetLong(10004)==FBX_ALL:
self.FBX_Format_M()
if self.GetLong(10004)==W_Obj:
self.OBJ_Format_M()
if self.GetLong(10004)==123346:
gui.MessageDialog('Sorry! \n MDL file format is not Supported at this time, \n this feature will be available in the future. \n This apart of C4DtoFlightSim SDK')
elif self.GetLong(10004)==Exporter_Button:
gui.MessageDialog('Error 299 :Please Select A Export Format\nin the drop down list\nand have a good day!')
print "Please Select A Export Format"
elif self.GetLong(10010)==ID_CM:
if self.GetLong(10004)==DAE_1_4:
self.DAE_1_4_Format_CM()
if self.GetLong(10004)==thee_Ds:
self.Three_DS_Format_CM()
if self.GetLong(10004)==FBX_ALL:
self.FBX_Format_CM()
if self.GetLong(10004)==FBX_ALL:
self.OBJ_Format_CM()
if self.GetLong(10004)==123346:
gui.MessageDialog('Sorry! \n MDL file format is not Supported at this time, \n this feature will be available in the future. \n This apart of C4DtoFlightSim SDK')
elif self.GetLong(10004)==Exporter_Button:
gui.MessageDialog('Please Select A Export Format \n And have a good day!')
print "Please Select A Export Format"
elif id==ABOUT["id"]:
self.About()
return True
elif id==Check_for_Updates["id"]:
self.Check_for_Updates()
return True
return True
#____END OF Comands____#
#_Addons Menu on top =(About, Check for Updates)
#_About In ifo ________#
def About(self) :
# MENU ITEM - About
# Open a messagebox with about info
gui.MessageDialog("This is the Selected Object Exporter from FlightSim SDK\nfor Cinema 4D Users\n---------------\nThis Plugin let you Export the Selected Object\nfrom your scene.\n---------------\nCreated By Ashton Rolle,Creswell Gould and Beris Omerović\nEmail Us: ( [email protected])\n---------------\nQuantumDrop Studios-Copyrights 2015", c4d.GEMB_OK)
return True
#_CHeck for Updates____#
def Check_for_Updates(self) :
self.Dialog2 = UpdateDialog()
self.Dialog2.Open(dlgtype=c4d.DLG_TYPE_ASYNC, defaultw=400, defaulth=150, xpos=-1, ypos=-1)
return True
#____The Plugin Info and Plugin Register_______#
class SelectedObjectExporter(c4d.plugins.CommandData) :
dialog = None
def Init(self, op) :
return True
def Message(self, type, data) :
return True
def Execute(self, doc) :
if self.dialog is None:
self.dialog = SelectedObjectExporterDialog()
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaultw=320, defaulth=200)
if __name__ == '__main__':
bmp = c4d.bitmaps.BaseBitmap()
dir, file = os.path.split(__file__)
fn = os.path.join(dir, "res/Icons", "Icon_3.png")
bmp.InitWith(fn)
print "Selected Object Exporter loaded."
result = plugins.RegisterCommandPlugin(PLUGIN_ID, "SelectedObjectExporter", 0, bmp, "SelectedObjectExporter", SelectedObjectExporter())