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
        invertSelection;
        
        // 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
    ConvertSelectionToFaces;
    
    // 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 V direction or change the Repeat V value on the place2dTexture node.
If you have end caps, you need to separate them first and than use this tool (sorry, maybe in the future).

Cheers, D

One comment

Leave a Reply to ddankhazi Cancel reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

You are commenting using your Twitter 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.