// =========================================================================== // 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. // =========================================================================== // // // Creation Date: March, 2006 // // Description: // This is the script used to implement menus for the setNClothStartState // menu. // global proc performSetNClothStartState( int $setStartState ) { int $noNObjectSelected = 1; int $index; // First check for nParticles string $pSel[] = `ls -sl -dag -exactType nParticle`; for( $index = 0; $index < size($pSel); $index++ ){ $noNObjectSelected = 0; if( $setStartState ){ saveInitialState( $pSel[$index] ); } else { clearParticleStartState( $pSel[$index] ); } } // list all the meshes selected // string $mSel[] = `ls -sl -dag -type mesh -visible -noIntermediate`; // Search for all nucleus meshes, and set/clear start state as appropriate // string $mesh = ""; string $cloth = ""; for( $index = 0; $index < size($mSel); $index++ ){ string $meshSel = $mSel[$index]; $cloth = findTypeInHistory( $meshSel, "nCloth", 1, 1 ); if( $cloth != "" ){ $noNObjectSelected = 0; string $cmd = "nBase -e -" + ($setStartState?"stuff":"clear") + "Start " + $cloth; evalEcho( $cmd ); if( !$setStartState ){ // Force a refresh // dgdirty( $cloth + ".outputMesh" ); refresh -f; } } } if( $noNObjectSelected ){ if( $setStartState ){ error( (uiRes("m_performSetNClothStartState.kUnableToSet"))); } else { error( (uiRes("m_performSetNClothStartState.kUnableToClear"))); } } }