/* Script Name: acUVFlipToLeft 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 left of original position. Usage: Flip a mirrored UV shell and position it to the left of 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 acUVFlipToLeft() { 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 horizontal axis. //-flipType 0 is horizontal flag. // -flipType 1 is vertical flag. polyFlipUV -ft 0; //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 width and move shell that amount. //To move in negative direction value is multiplied by (-1). float $uvAlignToMin = $uvMax[0] - $uvMin[0]; $uvAlignToMin = $uvAlignToMin * (-1); string $cmd = `polyEditUV -r true -u $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"); }