Aug 26, 2021
1 mins read
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
