-- 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 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 ( if DiffuseArr.count == MaskArr.count do ( for i=1 to MaskArr.count do ( meditMaterials[i] = standard diffuseMap:(Bitmaptexture fileName:DiffuseArr[i]) opacityMap:(Bitmaptexture fileName:MaskArr[i]) ) ) ) ) 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 ) )