Scripts For 3D Artists
Material IDs
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. The sceneMaterials variable will now be updated, all you have to do is press the update button on the rollout to refresh its list.
Selection Only: Operate on only the selected objects. When disabled will operate on all scene objects.