// =========================================================================== // 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: // textureEditorToggleIsolateSelect // // Description: // Toggle isolate select for texture editor. // global proc textureEditorToggleIsolateSelect(){ string $originalSelection[] = `ls -sl`; float $origPivot[] = uvTkGetUVPivot(); string $mesh = ""; if (size($origPivot) == 2) { // get mesh string $buffer[]; tokenize $originalSelection[0] "." $buffer; $mesh = $buffer[0]; // Set pivot for isolate undo. setAttr ($mesh + ".uvPivot") $origPivot[0] $origPivot[1]; } string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; int $viewState = `optionVar -q textureWindowShaderFacesMode`; textureWindowShaderFacesMode( $texWinName[0], "textureWindow", 1 ); if($viewState == 0 ){ textureEditorIsolateSelect 0; textureEditorIsolateSelect 1; txtWndUpdateEditor( $texWinName[0], "textureWindow", "null", 101 ); } // We restore original selection here since there is a common selection issue here: // Assume we have a DG chain is polySphere1->OpNodeX->pSphreShape1, now we select some components, // then setAttr OpNodeX.attrX to trigger a evaluation for meshShape, active group data which stored in // meshShape.outPolyGeom will be overrided by meshShape.inPolyGeom. Consider Maya selection implemention // now, fixing it essentially will cost much price, so we re-select to hack this isolate bug. if (size($originalSelection[0]) > 0) select -r $originalSelection; else select -clear; if (size($origPivot) == 2 && $mesh != "") { // Set pivot to original, since reselection will change pivot position to center. setAttr ($mesh + ".uvPivot") $origPivot[0] $origPivot[1]; } }