2010

Table Of Contents
To use flags with multiple arguments in Python
1 Create a yellow tinted point light by typing the following:
cmds.pointLight(rgb=(1,1,0.5))
The point light command creates a point light at the origin. The rgb flag
specifies the color of the light. The rgb flag require three values; red,
green and blue.
When flags require multiple values, the values must be packed within
Pythons tuple or list data types. Tuples are a method of storing multiple
items of homogenous data within a single variable, similar to an array
in MEL. The list is similar to the tuple, but supports multiple data types
within a single variable. The above command packs the RGB values into
a tuple. You could also use a list to achieve a similar effect.
2 Move the currently selected light by typing the following:
cmds.move(12,15,12)
3 Create a blue tinted light by typing the following:
cmds.pointLight(rgb=[0.2,0.2,1])
Square brackets [ ] indicate lists, and parentheses ( ) indicate tuples.
The values for the rgb flag can be packed into either a list or a tuple and
perform the identical operation.
4 Move the currently selected light by typing the following:
cmds.move(12,15,-5)
5 Select the polygonal cube and polygonal sphere by clicking the polygonal
cube, then shift clicking the sphere.
6 Frame the selected objects by pressing the f hotkey on your keyboard.
7 Render the scene by pressing the render current frame button
on
the Status line.
The Render View opens and displays the following image.
710 | Chapter 13 Scripting in Maya