// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // =========================================================================== // // Procedure Name: // texLayoutAlong // // Description: // UV workflow function used for snap UV shells to the default UV range // boundaries (9 $directions - top, bottom left, center, right, etc...) // // Input Arguments // direction - String - What cardinal direction to snap to. // // Return Value: // None. // // Notes: // This script is part of the implementation of Nightshade UV Editor into // Autodesk Maya. For testing purposes, keep the source commands at the top // and then just source this entire script. // // =========================================================================== global proc texLayoutAlong(int $type) { // Get original selection and retrieve the selected UV shells string $selection[] = `ls -selection`; string $compSelType = `getComponentMask`; string $selectObj[] = `ls -objectsOnly -selection`; for ($o in $selectObj) { string $selectComponent[] = `ls -sl $o`; polyLayoutUV -constructionHistory true -flipReversed true -gridU 1 -gridV 1 -layout 1 -layoutMethod 1 -percentageSpace 0.2 -rotateForBestFit 1 -scale 1 -separate 0 $selectComponent ; } // Along V if ($type == 1) { polySelectBorderShell(0); polyEditUV -angle 90 -pivotU 0.0 -pivotV 0.0 ; texAlignShells("uMin", {}, ""); float $uvBox[] = `polyEvaluate -boundingBoxComponent2d`; float $offset = $uvBox[1] - $uvBox[0]; polyEditUV -uValue $offset ; } //restore the original component mask setComponentMask($compSelType); //select the original selection select -replace $selection; }