-- made by Jos Balcaen ( function getImages = () local DiffuseArr = #() local MaskArr = #() local MaterialArr = #() rollout rollMaterials "Make Materials" ( button btnDiffuse "get diffuse" width:150 button btnOpacity "get masks" width:150 button btnCreateMaterial "create materials in editor" width:150 tooltip:"create the materials in the editor, max 24" button btnCreateLibrary "create materiallibrary" width:150 tooltip:"create the materials in a library" on btnDiffuse pressed do ( DiffuseArr = getImages() btnDiffuse.text = "diffuse (" + DiffuseArr.count as string + ")" ) on btnOpacity pressed do ( MaskArr = getImages() btnOpacity.text ="masks (" + MaskArr.count as string + ")" ) on btnCreateMaterial pressed do ( for i=1 to DiffuseArr.count do ( mat = standard diffuseMap:(Bitmaptexture fileName:DiffuseArr[i]) name:(getFilenameFile DiffuseArr[i]) if MaskArr[i] != undefined do mat.opacityMap = (Bitmaptexture fileName:MaskArr[i]) if i < 25 do meditMaterials[i] = mat ) ) on btnCreateLibrary pressed do ( for i=1 to DiffuseArr.count do ( lib = materialLibrary() mat = standard diffuseMap:(Bitmaptexture fileName:DiffuseArr[i]) name:(getFilenameFile DiffuseArr[i]) if MaskArr[i] != undefined do mat.opacityMap = (Bitmaptexture fileName:MaskArr[i]) append lib mat ) fileSaveAsMatLib() ) ) createDialog rollMaterials style:#(#style_toolwindow,#style_sysmenu) function getImages = ( theDialog = dotNetObject "System.Windows.Forms.OpenFileDialog" --create a OpenFileDialog theDialog.title = "Select Diffuse" --set the title theDialog.Multiselect = true --allow multiple files to be selected theDialog.Filter = "JPG (*.jpg)|*.jpg|All Files (*.*)|*.*" --specify the filter theDialog.FilterIndex = 1 --set the filter drop-down list to All Files result = theDialog.showDialog() --display the dialog, get result into variable result.ToString() --when closed, convert the result to string result.Equals result.OK --returns TRUE if OK was pressed, FALSE otherwise result.Equals result.Cancel --returns TRUE if Cancel was pressed, FALSE otherwise return theDialog.fileNames --the selected filenames will be returned as an array ) )