version:2.8
date:24 oct 2012
language:mel script
maya:version 2009+
XformUV is a tool for editing UVs with numerical precision. It includes functions such as move, rotate, scale, align, stack and orient UVs.

Move

The move tool is the main reason why I created this script. I needed a method of quickly giving UVs an offset of 1. This is useful for temporarily moving UVs out of the way or for moving overlapping UVs out of the 0-1 range. Overlapping UVs can result in artifacts when baking textures (shadow maps, occlusion, 3d textures, normal maps). By moving them out of the 0-1 range they are not used by the baking process. With an offset of exactly 1 the textures on the UVs appear unchanged.

Calc: UV Difference – This function can be found in the popup menu to the right. It measures the distance between two UVs for the U and V value.

Change Precision – This changes the number of decimals on the text fields. It only affects the display. The internal calculations use a 15 digit precision.


Rotate
The rotate tool has several presets in a popup menu and you can specify a custom pivot position.

Quick Presets – The quick preset buttons perform the rotate instantly. The presets found in the popup menu to the far right only copy their value to the text field and do not perform the rotate.

Calc: UV Angle – This utility can be found in the popup menu and calculates the angle between two UVs. This can be used for straightening out rotated parts.

Set Pivot – Here you can specify a custom pivot point. By default the UVs rotate around their center point. The popup menu contains presets and functions.


Scale
The scale tool is very similar to the rotate tool. It has presets in the popup, it has quick presets and you can specify a custom pivot position.

Mirror U / V – This mirrors UVs with the option to specify a pivot point. By default it mirrors around its center.

Divide Values (1 / Value) – This seemingly obscure functionality can be found in the upper popup menu. With this you can rescale something back to its original size. For instance 400% becomes 25%. It can also be used to obtain fractions. For instance if you divide 16 it becomes 1/16, which is 0.0625.


Extras
In the extras tab I have placed some of my other UV editing scripts. If you right click on the buttons then you can copy them to your current shelf.

Orient Shells – This function straightens the orientation of your selected UV shells. It treats each shell separately. The straightening is done by looking at the bounding box size of a shell. With most shapes this seems to work. This script works faster if you select less UVs per shell. This is noticeable with high UV counts (10k+). Ideally you only need to select one UV per shell.

Orient Single – This orients a single UV shell. It skips the shell definition pass which can be time consuming on high polygon objects. Recommended if you need to orient only a few shells that have a lot of UVs.

Stack Shells – This places UV shells exactly on top of each other. Useful for meshes that are similar and that can  share the same texture space. It only moves the shells. It does not do anything fancy like match scale or orientation.

Center UVs – This moves the selected UVs as a whole to the center (0.5, 0.5). Useful for layouts that are symmetrical (for instance heads).

Align UV Shells – This aligns UV shells to each other.
Just like with Orient Shells you will get a faster performance if you select less UVs per shell.

Flatten UVs – This flattens UVs to their minimum, maximum or center.


Download
You can download this script from Creative Crash or from my site. For bug reports or feature requests please visit Creative Crash.



Installation
Windows | Maya 2013
1) Open the zip file and copy the scripts (.mel) to this directory:
Documents/maya/2013/scripts/

2) Copy the icons (.bmp) to this directory:
Documents/maya/2013/prefs/icons/

3) Restart Maya or enter rehash in the script editor.


Usage
To run this script enter the following command in the script editor:
sdv_xformUV

If you wish to install a button on your current shelf then enter the following command:
sdv_shelfButton("sdv_xformUV", "sdv_xformUV", "sdv_xformUV.bmp")


Version History
v2.8 – 24 Oct 2012 – Fixed GUI problems with Maya 2011-2013
v2.7 – 03 Nov 2008 – Added Center, Flatten and Orient.
v2.6 – Added Align UV Shells.
v2.5 – Added Stack UV Shells. Created a more streamlined UI.
v1.0 – 07 Jan 2000 – Created the move section.