The following functions are specific to materials and the use of materials with the Material Editor:
you can get the materials in the material editor slots 1 through 24.
foo = getMeditMaterial 3
setMeditMaterial <slot_index> <material>
complements the getMeditMaterial function allowing you to place a material into the numbered material editor slots. Accepts either materials or texture maps as <material>.
Loads the default 3ds Max material library file.
Loads the named 3ds Max material library file, which becomes the current material library. If the file name does not have a fully specified directory path, the function searches through all the currently configured bitmap paths. Returns true if the loads succeeds, false if it fails.
Saves the current material library into the named file. Returns true if the save succeeds, false if it fails.
This method displays the File Open dialog and allows the user to select a material library to load.
Displays the standard Save File As dialog to allow the user to save the current material library.
If the current material library has been saved previously (has been named) this method saves the material library to the same file. Otherwise it displays the standard Save File As dialog to allow the user to save the current material library.
For details on the quiet: option available in 3ds Max 8 and higher, please see Quiet Mode
Returns the current material library file name as a String value.
renderMap <textureMap> [into:<bitmap>] [size:<point2>] [filename:<string>] [scale:<float>] [filter:<boolean>] [display:<boolean>]
Provides access to the Render Map function available in the Material Editor. The function returns a Bitmap value containing a rendering of the given texture map. If you specify the optional into: argument, the function renders the map into the supplied bitmap, taking size and other attributes from the existing bitmap. If you don't, a new bitmap value is created using the size: and fileName: arguments in its creation. If the into: and size: parameters are not specified, the default size in [200,200].
The scale: argument is a scale factor applied to 3D TextureMaps. This is the scale of the surface in 3d space that is mapped to UV and controls how much of the texture appears in the bitmap representation.
If the filter: argument is true, the bitmap is filtered. It is quite a bit slower to rescale bitmaps with filtering on. Defaults to false.
If the display: argument is true, the resulting bitmap is displayed using the virtual frame buffer; otherwise it is not. Defaults to false.
rm = renderMap $foo.material.diffuseMap size:[640,480] \
The above will render a map to a bitmap and save it as a .bmp file.
showTextureMap <material> [<texmap>|<material>] <boolean>
This provides control over the visibility of textures in the shaded viewport. You specify the material containing the texture map, the texture map in that material to be controlled and a boolean to turn the display on or off, for example:
showTextureMap $foo.material $foo.material.diffuseMap on
tm = checker()
mat = standardMaterial diffuseMap:tm
mm = multimaterial()
mm = mat
$box01.material = mm
showTextureMap mm tm on
Note that for multimaterials, you need to specify the appropriate sub-material (using  indexing, for example).
See showTextureMap() function for details.
The following 3ds Max system global variables are applicable to the Material Editor:
Contains a virtual array of materials and root level maps corresponding to the currently opened material library. You can get library materials via array indexing and iterate over them in a for loop. The array can be indexed by number, or by name or string to select by material name. This variable is read-only. See MaterialLibrary Values for more information.
Contains a virtual array of materials and root level maps corresponding to the slots in the material editor. You can access material editor materials and root level maps via array indexing and iterate over them in a for loop. The array can be indexed by number to specify slot number or name or string to select by material and root level map name.
$foo.material = meditMaterials
meditMaterials["foo mat"].diffuse = red
for m in meditMaterials do print m.diffuseMap
print meditMaterials.count -- number of slots
This variable is read-only, but the elements (the materials in the slots) are assignable. See MaterialLibrary Values for more information.
Contains a virtual array of materials and root level maps corresponding to the materials and root level maps present in the scene. You can get scene materials and root level maps via array indexing and iterate over them in a for loop. The array can be indexed by number, or by name or string to select by material or root level map name. This variable is read-only. See MaterialLibrary Values for more information.
MatEditor - Open and Close the Material Editor