uv straightening/alignment (maya)

What’s the best way to straighten out and align the UVs of a mesh like in the following image:


This particular image shows the two UV sets included in one of the lava river meshes from Epic’s Elemental Demo. The left UVs are in channel 0 and the right UVs are channel 1. Since the lava material flows in the direction of the UVs it’s important to make sure all of the UVs are pointing in the desired flow direction.


I’d also like to know because this is sometimes necessary when setting up lightmap UVs.

I also would love to hear a way to automate this process.