ArrayParameter Values

Certain plug-ins in 3ds Max store parameter data in a form that is accessible by MAXScript as ArrayParameters. As such, you can access the parameter data by index and iterate over the parameter data.

Constructors

<MAXWrapper>.parameter

Where the parameter contains an ArrayParameter.

Properties

<ArrayParameter>.count

Returns the number of values in the ArrayParameter. Read-only in most cases with exceptions noted in the MAXWrapper object description where an adjustable ArrayParameter is used.

Operators

<ArrayParameter>[<integer>]

Returns the element of ArrayParameter. Indexes start at 1.

<ArrayParameter>[<integer>] = <value>

Sets the element of ArrayParameter to a value.

Each ArrayParameter can only contain data of a certain type (for example, Float), or a controller that matches that data type. The showProperties() function indicates these array parameters as <type> array , for example, int array , texmap array , and so on.

A plug-in can also define parameter names that point to specific entries in one of its ArrayParameters. For example, mapAmounts is a property of Standard materials containing an ArrayParameter. Each element in this ArrayParameter contains the map amount for one of the map channels. For easier access in a script, the Standard .ambientMapAmount property is provided as an alias for mapAmounts\[1\] (along with aliases for all the other common maps). You can access the controller for the ambientMapAmount alias either through the .controller property on the alias or on the .mapAmounts\[1\] property.

FOR EXAMPLE,

either

   $foo.material.ambientMapAmount.controller

or

   $foo.material.mapAmounts[1].controller

will get the controller on the ambient map amount material property.

ArrayParameter values can be coerced to Array in 3ds Max 6 and higher.

FOR EXAMPLE

   mtl = standard()
   mapsArray = mtl.maps as array

The following script shows the use of showProperties() to show the data type for elements of ArrayParameters, access to ArrayParameter elements, and a case of a plug-in defining parameter names that point to a specific entry in one of its ArrayParameters.

SCRIPT

   m=CompositeMaterial() -- create a Composite material
   showproperties m -- show the properties for the material
   m.amount -- show value of parameter amount
   m.amount[1] *= .5 -- reduce the value for one element
   m=standard() -- create a Standard material
   showproperties m -- show it’s properties
   m.ambientMapAmount=13 -- set the value for one element via its alias
   m.mapAmounts[1] -- and show the element was changed

OUTPUT

   compositematerial:Composite -- result line 1
   .materialList (Material : material array -- output line 2
   .mixType (Composite Type) : int array -- ArrayParameter elements are integer
   .mapEnables (Map Enable) : boolean array -- ArrayParameter elements are boolean
   .amount : float array -- ArrayParameter elements are float
   OK -- result line 2
   #(100, 100, 100, 100, 100, 100, 100, 100, 100, 100) -- result line 3
   50.0 -- result line 4
   Standardmaterial:Standard -- result line 5
   .mapEnables (Map Enables) : boolean array -- pruned output line 6
   .maps : texmap array
   .mapAmounts (Map Amounts) : percent array
   .ambientMap (alias for maps[0])
   .ambientMapAmount (alias for mapAmounts[0])
   .ambientMapEnable (alias for mapEnables[0])
   .bumpMap (alias for maps[8])
   .bumpMapAmount (alias for mapAmounts[8])
   .bumpMapEnable (alias for mapEnables[8])
   13 -- result line 7
   13.0 -- result line 8