// =========================================================================== // 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. // =========================================================================== // // // // // // displayNClothMesh( string $meshType ) // // // None. // // // This sets the selected nCloth objects to display either their input or current position meshes. // It is equivalent to calling the menu items "Display Input Mesh" and "Display Current Mesh". // // // string $meshType Set to either "input" or "current". // // // displayNClothMesh "input" // global proc displayNClothMesh( string $mType ) { // First, find the nCloths directly selected // string $nCloths[] = getSelectedNObjs( "nCloth" ); int $badSelection = true; int $numCloths = size($nCloths); int $index = 0; while( $index < $numCloths ){ string $nNode = $nCloths[$index]; $index++; // Choose which mesh to display - at the moment, we can easily have history between the // nCloth node and output mesh, but we expect the input mesh to be directly connected // If we support workflows that would encourage history between the input mesh and // ncloth, we would need to look for it too. string $downstreamNodes[] = `listHistory -f 1 $nNode`; string $oMeshes[] = `ls -dag -type mesh $downstreamNodes`; string $iMeshes[] = `listConnections -sh true -type mesh ($nNode + ".inputMesh")`; string $oMesh; string $iMesh; if( size($oMeshes) >= 1 ){ $oMesh = $oMeshes[0]; } else { continue; } if( size($iMeshes) >= 1 ){ $iMesh = $iMeshes[0]; } else { continue; } $badSelection = false; if( $mType == "input" ){ setAttr ($iMesh + ".visibility") true; setAttr ($iMesh + ".intermediateObject") false; setAttr ($oMesh + ".intermediateObject") true; } else { setAttr ($iMesh + ".intermediateObject") true; setAttr ($oMesh + ".intermediateObject") false; setAttr ($oMesh + ".visibility") true; } } if( $badSelection ){ warning((uiRes("m_displayNClothMesh.kNoValidClothNodes")) ); } }