// ========================================================================== // http://www.tjgalda.com // // Copyright (C) 2007 TJ Galda. All rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to TJ Galda which is protected by U.S. and // Canadian federal copyright law and by international treaties. // // The Data is provided for use exclusively by You. You have the right // to use, modify, and incorporate this Data into other products for // purposes authorized by TJ Galda, without fee. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the // following disclaimer, must be included in all copies of the // Software, in whole or in part, and all derivative works of // the Software, unless such copies or derivative works are solely // in the form of machine-executable object code generated by a // source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // TJ GALDA DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR // PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE, OR // TRADE PRACTICE. IN NO EVENT WILL TJ GALDA AND/OR ITS LICENSORS // BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL, // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF TJ GALDA // AND/OR ITS LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY // OR PROBABILITY OF SUCH DAMAGES. // // http://www.tjgalda.com // ========================================================================== // // TJ Galda Script File // MODIFY THIS AT YOUR OWN RISK // // Creation Date: tj, october 30, 2008 // // Procedure Name: // tj_nudgePixels // // Description: // super simple tool create a ui that will nudge the selected // object(s) based upon the amount of pixels you've chosen in the ui via // a slider // // // Input Arguments: // None // // Return Value: // None. // // http://www.tjgalda.com // ========================================================================== global proc tj_nudgePixels() { //create a window to work // ////////////////// // start window ////////////////// string $tj_np_winName = "nudgePixelsWin"; if ( `window -exists $tj_np_winName` ) { deleteUI -window $tj_np_winName; } // string $tj_np_temp = `window -widthHeight 328 161 -title ("Nudge the Selected Objects tj galda") -in "Nudge the Selected Objects" -rtf true -mxb false -s true $tj_np_winName`; $tj_np_winName = $tj_np_temp; //build initial window string $tj_np_formLayout = `formLayout`; rowColumnLayout -nc 3 -cs 1 3 -cs 2 5 -cs 3 5 ; //spacer text -l ""; text -l ""; text -l ""; //up text -l ""; string $tj_np_upButton = `button -label "Up" -c "tj_nudgePixelDo" -bgc 0.9 0.9 0.5 -h 23 upButton`; text -l ""; //left string $tj_np_leftButton = `button -label "Left" -c "tj_nudgePixelDo" -bgc 0.2 0.9 0.6 leftButton`; text -l " Nudge it..."; //right string $tj_np_rightButton = `button -label "Right" -c "tj_nudgePixelDo" -bgc 0.9 0.3 0.3 rightButton`; //down text -l ""; string $tj_np_downButton = `button -label "Down" -c "tj_nudgePixelDo" -bgc 0.9 0.9 0.5 -h 23 downButton`; text -l ""; //spacer text -l ""; text -l ""; text -l ""; //move back up to form layout setParent ..; //distance bar string $tj_np_colLayout = `columnLayout`; string $tj_np_nudgeSlider = `intSliderGrp -label "Pixel Distance" -field true -minValue 1 -maxValue 50 -fieldMinValue 1 -fieldMaxValue 1000 -ann "This value represents how many pixels the selected object will move" -value 1 nudgeSlider`; setParent ..; //position the slider nicely formLayout -e -attachForm $tj_np_colLayout "top" 100 -attachForm $tj_np_colLayout "left" -60 $tj_np_formLayout; //show window showWindow $tj_np_winName; //update buttons button -e -c ("tj_nudgePixelDo up "+$tj_np_nudgeSlider) $tj_np_upButton; button -e -c ("tj_nudgePixelDo left "+$tj_np_nudgeSlider) $tj_np_leftButton; button -e -c ("tj_nudgePixelDo right "+$tj_np_nudgeSlider) $tj_np_rightButton; button -e -c ("tj_nudgePixelDo down "+$tj_np_nudgeSlider) $tj_np_downButton; } global proc tj_nudgePixelDo (string $tj_np_direction, string $tj_np_nudgeSlider) { //harvest pixel distance data and move appropriately float $tj_np_pixelDistance = `intSliderGrp -q -v $tj_np_nudgeSlider`; if ($tj_np_direction == "up") { pixelMove 0 $tj_np_pixelDistance; } else if ($tj_np_direction == "right") { pixelMove $tj_np_pixelDistance 0; } else if ($tj_np_direction == "left") { $tj_np_pixelDistance = $tj_np_pixelDistance * -1; pixelMove $tj_np_pixelDistance 0; } else { $tj_np_pixelDistance = $tj_np_pixelDistance * -1; pixelMove 0 $tj_np_pixelDistance; } }