This script takes a particle object and any number of polygon mesh objects the user wants to instance to the particles, and eliminates the annoying task of adding custom attributes and writing the selection code yourself.
The script currently features two steps:
Step 1. Creates an instancer for the particle object, and adds the selected geometry to its list of instanced objects. This however is not enough to use multiple objects in a random manner.
Step 2. Adds a per-particle "pick" attribute to the particle's shape node, and sets it to contain the code necessary for each particle to instance any one of the objects in the instancer node's instanced objects list, in a random manner based on its unique particle ID.
To add a button to your shelf:
1. Place the kwInstancerSetup.pyc file in your user scripts directory.
2. Place the .bmp file in your prefs/icons directory. Excuse the ugly icon; instancer is a long word for a 32x32 pixel space!
3. Source or drag-and-drop the .mel file. This will create a button on your current shelf.
4. Click the newly created shelf button.
Alternatively, run the following code from a Python tab in the Maya Script Editor:
except NameError: import kwInstancerSetup as kw