Scripts For 3D Artists

Material List

NOTE: In 3ds Max there is a global variable called “sceneMaterials” that contains all the current scene materials. However since at least Max 2009 there is a bug that causes the sceneMaterials variable to not properly update when, for example, scripts add/remove materials. This can (and most likely will at some point) cause incorrect results when using scripts that deal with adding/removing/listing materials.

If you find incorrect results (such as a material that should no longer exist) there is an easy solution. In order to properly update the sceneMaterials variable simply apply a new material using the material editor. Here is the process I like to use: Take a piece of geometry in your scene and sample its material into one of the editor slots. Now apply an unused material to the geometry (like one of the default materials) and then apply its original material.

 

Material list UI preview

Material List (listview): The list of scene materials. The total number of materials is only for root materials, sub materials are not counted.
Filter: Filters the material list. NOTE: Search is case sensitive. Also sub materials are not filtered, only root materials.
Update: Updates the material list.
Show All Sub Materials: When enabled sub materials will appear the list under their parents.
Force Material Update: Force max to update its internal material list, ensuring this tool’s material list is accurate. WARNING: This process can be very slow if your scene has a lot of layers in it.
Show Material(s) in Editor: Shows the selected materials in the material editor.
Slot number (spinner): The slot number to place the selected material. Ignored if using the Slate Editor. If multiple materials are selected then the placement will start at this slot number and continue forward.
Reset Editor: Resets the material editor slots. Also deletes all views if using the Slate Editor.
Std Materials: When enabled the material editor will be reset with standard max materials.
Select Objects with Material(s): Selects all objects (visible or not) that have the selected material(s) applied.
Keep Selection: When enabled the objects will be added to the current selection.
Assign Material to Selected Objects: Applies the selected material to the selected objects.
Show Materials of Selected Objects: Places the materials of the selected objects in the sample slots of the material editor.
Assign Objects with Material(s): Assigns an OBJECT ID to the selected objects with the selected material(s) assigned.
Object ID (spinner): The Object ID value to be assigned.
Assign Material(s): Assigns a MATERIAL ID to the selected material(s).
Material ID (spinner): The Material ID value to be assigned.
Save Selected Materials to File: Saves the selected materials to a *.mat file.
Remove Duplicate Name Materials: Searches all root materials for duplicate names (sub materials are ignored). If 2 or more materials have the same name the first material with that name will be applied to all objects with those materials.
Status: The status of the script.