/* Script Name: acUVFlipToBottom Modified: June 2009 What Script Does: Selects UV shell. Flips UV shell. Gets UV shell bounding box width and height. Moves UV shell to the bottom of original position. Usage: Flip a mirrored UV shell and position it below the original UV shell so that the two shells no longer overlap. Instructions: Copy script to your scripts folder. Assign script to a hotkey or shelf icon. In Maya viewport, select one or more UVs on mirrored side of your model. Run script. In the UV Texture Editor, the shell is flipped and repositioned. */ global proc acUVFlipToBottom() { string $selectedItems[]; //Polygon UVs selection mask. $selectedItems = `filterExpand -ex true -sm 35`; if (size($selectedItems) == 0) return; float $uvMin[2]; float $uvMax[2]; //If only one UV is selected, selects entire shell. SelectUVShell; //Flip along vertical axis. //-flipType 0 is horizontal flag. // -flipType 1 is vertical flag. polyFlipUV -ft 1; //Get uv shell's bounding box. float $uvBox[] = `polyEvaluate -bc2`; $uvMin[0] = $uvBox[0]; $uvMin[1] = $uvBox[2]; $uvMax[0] = $uvBox[1]; $uvMax[1] = $uvBox[3]; //Get shell height and move shell that amount. float $uvAlignToMin = $uvMax[1] - $uvMin[1]; $uvAlignToMin = $uvAlignToMin * (-1); string $cmd = `polyEditUV -r true -v $uvAlignToMin`; //Update bounding box info. $uvBox = `polyEvaluate -bc2`; $uvMin[0] = $uvBox[0]; $uvMin[1] = $uvBox[2]; $uvMax[0] = $uvBox[1]; $uvMax[1] = $uvBox[3]; //Display bounding box info. print("uMin:"+$uvMin[0]+" uMax:"+$uvMax[0]+" vMin:"+$uvMin[1]+" vMax:"+$uvMax[1]+"\n"); }