Assigning UV coordinates to a pipe/tube/hose-like mesh

Hi all!

How would you assign UV coordinates to a mesh like the following:

http://www.christltimon.de/halde/pipe-uv-problem.png

Obviously, naive unwrapping won’t do it. I’d like the texture to wrap around the pipe exactly once, and to run along the pipe as many times as necessary so that each texel covers a roughly square portion of the pipe’s surface. In the above image, this would mean the UV coords should form a regular grid that stretches exactly from top to bottom in the UV window’s light gray rectangle, begins at the left of that rectangle, and extends as far right as determined by the length of the pipe (even beyond the right side of the light gray area in the UV window).

Does anyone know of a Python script that generates the UV coords I’d like to have? I think I would manage to write one myself, but it would be messy and it would take time, time I’d like to avoid if possible.

OK, to answer myself: there is now a script, because I just wrote one. See here: http://blenderartists.org/forum/showthread.php?p=760893#post760893