Material_Switcher : Material
Material_Switcher - superclass: material; super-superclass:MAXWrapper - 5:0 - classID: #(1322087590L, 0L)Exposes the functionality for the new Material Switcher material type.
Example
-- material switcher example
resetMaxFile #noprompt
t = teapot()
ms = Material_Switcher()
for i = 1 to ms.nummats do (
my_mat = standardMaterial diffuse:(random (color 0 0 0) (color 255 255 255)) name:(uniqueName "RndMat")
ms.materialList[i]=my_mat
)
t.material = ms
-- randomly assign a material
ms.selection = random 1 ms.nummatsProperties:
.materialList (Material) : material arrayAn array of materials assigned to the material switcher slots, with the array index corresponding to the slot number in the Material Switcher UI.
.names : string arrayAn array of material names. These are not the actual material names, but rather the names the user can assign to each slot.
.selection : integerGets/sets the currently selected material slot.
.nummats : integerThe number of material slots available in the switcher. By default this is 10.
.UILocked : booleanToggles the Material Switcher lock. When true, the user cannot change the selected material by clicking on a material icon.
.material1 (alias for materialList[0])The first material in the Material Switcher list.
Interfaces:
Interface: Material Switcher
Methods:
<material>GetActiveMaterial()Returns the currently active material.
<material>SelectMaterialByID <integer>IndexMakes the material at the specified index the selected material.
<material>SelectMaterialByName <string>NameMakes the material with the specified name the selected material. Note that this is not the actual material name, but the name assigned by the user to the slot, and the method will find the first complete match based on the index. If more than one material share the same user name, the first one will be returned.
<string>selectedname()Returns the slot name for the currently active material.
