It is like the Houdini copy node

The goal of this project was to create objects at the vertices of another object. The exact same function of the copy node of Houdini (a small fraction of it, of course). As usual with coding, there are many different approaches to this problem. A quick and dirty approach is to re-evaulate the object creation code each frame, deleting and re-creating the copied objects. A cleaner solution is to copy the objects and assign expressions to them making them follow the animated mesh. Of course if the mesh is high resolution, then there will be tons of objects copied on it, eventually crashing Maya. So the most elegant way to pull this off is to instance the objects instead of copying them, and attaching expressions to each instance.

Anyhow, I took the second route, and attached expressions to the copied objects.

First I tried to access each point by using something similar to objname.pt[pointnum].px. It didn't work as I expected initially. px, py, pz information stored per point on the mesh all use each point's origin, so since there isn't a point to world space conversion taking place, everything pops to the world origin, unless there is some sort of offset that tells the points otherwise. Also the px, py, pz information isn't effected by skin clusters, or any sort of deformation. The only thing effecting them is assigning keyframes to each point seperately.

Then, I decided to use the pointPosition command. Using a clever loop, I was able to assign each object that is copied an expression that would transform its position based on a point on the mesh.

I am not putting excerpts from the script here since it would make no sense at all when it is in pieces. So download the whole script instead.