Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Tool By Scobalula for easily moving UVs to specific parts of an image.
- This script (UV Mover) is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>
- */
- string $window = `window -title "Scoba's Dank UV Moving/Scaling Tool" -width 384`;
- columnLayout -adjustableColumn true;
- separator -height 15 -style "out";
- text -label "Square Image (1:1)";
- separator -height 15 -style "out";
- string $OptionMenuX = `optionMenu -label "Where to Move:" SquareValue`;
- menuItem -label "Select";
- menuItem -label "Top Left";
- menuItem -label "Top Right";
- menuItem -label "Bottom Left";
- menuItem -label "Bottom Right";
- separator -height 15 -style "out";
- button -label "Confirm" -command "ScaleUVsSquareImage";
- separator -height 15 -style "out";
- separator -height 15 -style "out";
- text -label "Rect. Image (1:2)";
- separator -height 15 -style "out";
- string $OptionMenuX = `optionMenu -label "Where to Move:" RectValue`;
- menuItem -label "Select";
- menuItem -label "Top Left";
- menuItem -label "Top Right";
- menuItem -label "Upper Middle Left";
- menuItem -label "Upper Middle Right";
- menuItem -label "Lower Middle Left";
- menuItem -label "Lower Middle Right";
- menuItem -label "Bottom Left";
- menuItem -label "Bottom Right";
- separator -height 15 -style "out";
- button -label "Confirm" -command "ScaleUVsRectImage";
- separator -height 15 -style "out";
- separator -height 15 -style "out";
- text -label "Move UVs to center:";
- separator -height 15 -style "out";
- string $OptionMenuX = `optionMenu -label "Move UV to center from:" ValueToMove`;
- menuItem -label "Select";
- menuItem -label "Left";
- menuItem -label "Right";
- menuItem -label "Bottom";
- menuItem -label "Top";
- separator -height 15 -style "out";
- button -label "Confirm" -command "MoveUVToImage";
- separator -height 15 -style "out";
- showWindow $window;
- global proc ScaleUVsRectImage()
- {
- string $ScaleMoveRect = `optionMenu -q -v RectValue`;
- switch($ScaleMoveRect)
- {
- case "Select":
- print("Select and option to move UV.\n");
- break;
- case "Bottom Left":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u -0 -v 0 -su 0.5 -sv 0.25 ;
- break;
- case "Bottom Right":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u 0.5 -v 0 -su 0.5 -sv 0.25 ;
- break;
- case "Lower Middle Left":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u -0 -v 0.25 -su 0.5 -sv 0.25 ;
- break;
- case "Lower Middle Right":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u 0.5 -v 0.25 -su 0.5 -sv 0.25 ;
- break;
- case "Upper Middle Left":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u -0 -v 0.5 -su 0.5 -sv 0.25 ;
- break;
- case "Upper Middle Right":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u 0.5 -v 0.5 -su 0.5 -sv 0.25 ;
- break;
- case "Top Left":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u -0 -v 0.75 -su 0.5 -sv 0.25 ;
- break;
- case "Top Right":
- print("UV Moved and scaled to " + $ScaleMoveRect + ".\n");
- polyEditUV -u 0.5 -v 0.75 -su 0.5 -sv 0.25 ;
- break;
- }
- }
- global proc ScaleUVsSquareImage()
- {
- string $ScaleMove = `optionMenu -q -v SquareValue`;
- switch($ScaleMove)
- {
- case "Select":
- print("Select and option to move UV.\n");
- break;
- case "Bottom Left":
- print("UV Moved and scaled to " + $ScaleMove + ".\n");
- polyEditUV -u -0 -v 0 -su 0.5 -sv 0.5 ;
- break;
- case "Bottom Right":
- print("UV Moved and scaled to " + $ScaleMove + ".\n");
- polyEditUV -u 0.5 -v 0 -su 0.5 -sv 0.5 ;
- break;
- case "Top Left":
- print("UV Moved and scaled to " + $ScaleMove + ".\n");
- polyEditUV -u -0 -v 0.5 -su 0.5 -sv 0.5 ;
- break;
- case "Top Right":
- print("UV Moved and scaled to " + $ScaleMove + ".\n");
- polyEditUV -u 0.5 -v 0.5 -su 0.5 -sv 0.5 ;
- break;
- }
- }
- global proc MoveUVToImage()
- {
- string $MoveOption = `optionMenu -q -v ValueToMove`;
- switch($MoveOption)
- {
- case "Select":
- print("Select and option to move UV.\n");
- break;
- case "Left":
- print("UV Moved from Left to Center.\n");
- polyEditUV -u 1 -v 0 ;
- break;
- case "Right":
- print("UV Moved from Right to Center.\n");
- polyEditUV -u -1 -v 0 ;
- break;
- case "Bottom":
- print("UV Moved from Bottom to Center.\n");
- polyEditUV -u -0 -v 1 ;
- break;
- case "Top":
- print("UV Moved from Top to Center.\n");
- polyEditUV -u -0 -v -1 ;
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement