--this script is made by Anton Berg at os3d.se --anton[at]os3d.se rollout ExportObj "Export as separate files" width:232 height:107 ( global outPath local debug = true edittext edt1 "filename" pos:[8,83] width:152 height:16 readOnly:false button btn1 "Export" pos:[168,59] width:56 height:40 checkbox chk1 "Prefix of the file:" pos:[9,62] width:120 height:16 checked:true toolTip:"if this is checked then the prefix text will be used to name the file" dropDownList ddl2 "FileType" pos:[9,6] width:152 height:40 fn NewfileName inputPath objName ischecked nr= ( if ischecked == true then ( --set the filename to this prefix np = inputPath + "\\" + objName + "_"+ nr as string --+".obj" if debug then print np ) else ( --set the filename to the object filename np = inputPath + "\\" + objName --e+ ".obj" if debug then print np ) return np ) on ExportObj open do ( theClasses = exporterPlugin.classes theClassesNames = #() for exptyp in theClasses do ( append theClassesNames (exptyp as string) ) ddl2.items = theClassesNames ) on btn1 pressed do ( if outPath == undefined then outPath = "" outPath = getSavePath initialDir:outpath if outPath != undefined then ( selArray = selection as array sceneObjs =#() for item in selArray do ( try (explodeGroup item) catch() ) selArray = selection as array for item in selArray do ( if (isKindOf item GeometryClass) then append sceneObjs item ) for i = 1 to sceneObjs.count do ( oname = (if chk1.state then edt1.text else sceneObjs[i].name) if i == 1 then ( select sceneObjs[i] newName = NewfileName outPath oname chk1.state i exportFile newName selectedOnly:true using:(theClasses[ddl2.selection]) theClasses[ExportObj.ddl2.selection] ) if i > 1 then ( select sceneObjs[i] newName = NewfileName outPath oname chk1.state i exportFile newName #noPrompt selectedOnly:true using:(theClasses[ddl2.selection]) ) ) select sceneObjs ) else ( messagebox "No output path selected" ) ) on chk1 changed theState do ( if theState then edt1.readOnly = false else edt1.readOnly = true ) ) createdialog ExportObj