|
To manipulate various objects or properties you will
use arrays. Arrays are variables that contain several other variables indexed.
variable = #() Its values are accessed this way: variable[x], where x is an integer number indicating an element in the array Inside MAX we have several predefined arrays, such as object classes: Lights, geometry, shapes, cameras, helpers, spacewarps To access each object in these arrays, simply add [1], [2], etc. after the class name. This makes it easier to manipulate all scene lights in a script. Among array properties you can use .count, which indicates how many elements are in that array. An example is light.count, which indicates how many lights exist in the scene.
Using Arrays and Loops, you can create a script that will create several copies of an Omnilight, positioning each of them in an object's vertex, simulating an area light.
The Mesh Select modifier was added to allow the commands getnumvert and getvert to work, since they require an Editable Mesh object to work. Notice that without loops and arrays, you would not be able to use this script in any object, cause you would not know how many vertices that object would have, making it impossible to know how many lights to create, etc. Execute the Enhanced_area_light.ms script, and observe how many more features can be added to a script. Alexander Esppeschit Bicalho © 1999 |