Hello guys, I found this useful script but I dont know how to modify it.
So I run the script, I click on "diffuse" and select some png bitmaps.
Then I click on "masks" and I select same png bitmaps once again.
Then in Material Editor I see on sample slots that Standard Materials
are created with the same png as diffuse and opacity map.
My question is how to :
-Replace Standard material with Arnold Standard Surface material.
-Assign all png and their copies as "Base Color" and "Opacity"
to this Arnold Standard Surface material
-Especially to the png assigned to "Opacity" enable the:
Bitmap parameters->RGB Channel Ouput->Alpha as grey
And of course if I have 1000 pngs to convert, how
to insert them into a material library automatically?
Really thanks for any help.
Cheers.
Petros.
(
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"
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
)
)