Material auto creation

Hello,
I am rather new to to maxScrip and I am looking to create an auto filling tool for the slate editor that will match maps to slots.The aim is that the user selects a file, that was used as a substance map output then the program looking at the created maps suffix pulls each in turn to the correct slot on the standard material.

I have a few of these elements already, I have the file dialog, an extracted file name the ability to match a texture from file to an existing material but what would be ideal is if, when pressing the button a new material appears in the slate editor with its node to the corresponding textures

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

if SME.IsOpen() do (
 
	mtl = standardmaterial()
	filenamePrefix = "sometexfile_"
	filenameExt = ".jpg"
 
	mtlProps = #(#( #bumpmap, "bmp" ), #( #diffusemap, "diff" ), #( #displacementmap, "disp" ))
 
	for prop in mtlProps do (
 
		filename = filenamePrefix + prop[2] + filenameExt
		tex = bitmaptexture filename:filename
 
		setProperty mtl prop[1] tex
 
	)
	(sme.GetView sme.activeView).createNode mtl [0,0]
 
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.