Code:
// Simple MEL script to provide a UI to some of the tools commonly used
// during the UV editing process. The script provides a way to scala and
// rotate by numerical amounts, rather than doing it interactively.
// While a mechanism is provided for rotating, there is none for scaling
// Date: 18 Dec 2006 Simon Beeching
// Title of pop-up window
window -title "UV Tools";
// variables used to retrieve the values of our sliders
float $RotVal;
float $ScaleVal;
// command string to be executed when the Rotate button is pressed
// (1) Query value of the rotation slider
// (2) Rotate by this amount around <0.5, 0.5>
string $RotCmd = "$RotVal = `floatSliderGrp -q -v RotSlideVal`; \
polyEditUV -pu 0.5 -pv 0.5 -a $RotVal ;";
// command string to be executed when the Scale button is pressed
// (1) Query value of the scale slider, AND divide by 100, since a scale value of 1 = 100%
// (2) Scale by this amount around <0.5, 0.5>
// NOTE: Negative values are allowed here. This has the effect of scaling, AND rotating by 180 degrees
string $ScaleCmd = "$ScaleVal = `floatSliderGrp -q -v ScaleSlideVal`/100.0; \
polyEditUV -pu 0.5 -pv 0.5 -su $ScaleVal -sv $ScaleVal;";
// the layout to be used for the window
columnLayout;
// Note the difference between the definition of the controls for scale and rotation
// the fieldMinValue and fieldMaxValue fields define the min and max values of the field.
// this means that you can specify a number that you can't select with the slider.
// After a value has been entered that is outside the default range for the slider, the slider's
// range changes. By default, you can scale from 0-100%. By entering a value in the box, you may
// scale between -100 and +500 %
// Define the slider and button to be used for Scaling
floatSliderButtonGrp -field true // ????
-buttonLabel "SCALE %" // Text that is on button
-buttonCommand $ScaleCmd // what to do when button is pressed
-minValue 0 // default min of slider
-fieldMinValue -100 // min value that can be entered in numeric box
-maxValue 100 // default max value of slider
-fieldMaxValue 500 // max value that can be entered in numeric box
-value 0 // value of slider at start-up
-columnWidth 1 40 // width of column1 = 40 pixels
ScaleSlideVal; // name of slider
// Define the slider and button to be used for Rotating
floatSliderButtonGrp -field true
-buttonLabel "ROTATE"
-buttonCommand $RotCmd
-minValue 0
-maxValue 360
-columnWidth 1 40
RotSlideVal;
showWindow();
Don't worry there's hardly anything to it, it's nearly all comments. Here's a screen shot of it when loaded.