Auto UV (almost) for Rope/Pipe Like Objects in Maya (updated)

Hi, here is my script to create UVs for rope/pipe-like objects in Maya.

How to use it

  • Select one edge (or edges on multiple geo shells, one on each) which will become loops and UV cuts/borders.
  • Run the script

Done. 🙂

The script

    // Store Selected Object
    string $sel[] = `ls -hl`;
    // Store Selected Components
    string $compSel[] = `ls -sl`;
    // Do stuff with each selected components
    for ($each in $sel)
        // Unitize UV
        polyForceUV -unitize $sel;
        // Convert to loop
        polySelectSp -loop;
        // Invert Selection
        // Move and Sew UVs at Selected Edges
        performPolyMapSewMove 0;
    // Select the object, so we can delete its history
    select $sel;
    // Delete History
    delete -ch;
    // Convert Selection so we can do UV editing
    // Stack the UV Shells
    texStackShells {};

    // Set U width while preserve Aspect ratio
    polyNormalizeUV -normalizeType 1 -preserveAspectRatio on -centerOnTile on -normalizeDirection 1;
    // A little bit of scaling in V direction
    polyEditUV -pu 0.5 -pv 0.5 -su 1 -sv 2.2;
    // Position them
    texSnapShells bottom;

    // Delete History (you can disable this if you want)
    select $sel;
    delete -ch;

Usually, you still have to change the scale of the UV Shells in the V direction or change the Repeat V value on the place2dTexture node.
If you have end caps, you need to separate them first and then use this tool (sorry, maybe in the future).

Cheers, D

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.