Python Examples
1. Object Randomizer
In this scene, I have created these rock formation using 'Object Randomizer' which is a Python program written by myself. This Object Randomizer shows up a Maya User Interface in which you can scatter, rotate, scale any selected objects in the scene randomly.
In general, this would faciliate the production pipeline especially when there are large number of similar objects that require some randomized variations.
In general, this would faciliate the production pipeline especially when there are large number of similar objects that require some randomized variations.
How It Works1. In Maya, I modeled and textured two rocks with same size but slightly different shapes. Then I duplicated these rocks to produce more than a dozen rocks for the scene. When finished, selected all the rocks' objects.
(Download the Object Randomizer python script on the left & it comes with an example of Maya scene files) 2. Open Maya script editor and open the Python script 'Object Randomizer'. Highlight the entire script and press <Ctrl> + <Enter> to execute the script. Then the Objects Randomizer program will pop up. Insert the appropriate X Y Z numeric values into the Range, Rotate, Scale value boxes. e.g. Range: 7, 0, 7; Rotate: 60, 45, 50; Scale: 4, 4, 4 and then press <.. Selected Objects> buttons to execute the actions.
|
|
3. Here is the finished rock formation after executing three actions - Disperse, Rotate, Scale from the 'Object Randomizer' python script.
2. Lights Group Controller
I have written a python script which controls all the light intensities of the Christmas tree lights. The result is shown on the two renderings (Higher intensity on the left while lower intensity on the right)
|
To use the script, open Maya script editor and open the Python script: 'lights_group_controller.py'.
Highlight the entire script and press <Ctrl> + <Enter> to execute the script. Then the Light Group Controller UI will pop up. Insert the desired Intensity values and then press <Update All Light Intensity> button to execute the action. Note: You can download the sample Maya scene for the Christmas tree light: http://www.3drender.com/challenges/christmas/ChristmasChallenge_MA.rar |