// =========================================================================== // 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. // =========================================================================== proc string setupMembrane( string $mesh ) { string $membrane = `createNode membrane`; string $meshIn = ($mesh + ".inMesh"); string $inPlug = `connectionInfo -sfd $meshIn`; if( $inPlug == "" ){ string $dup[] = `duplicate -rr -name polySurface1 $mesh`; $dup = `ls -dag -shapes $dup[0]`; string $inMesh = $dup[0]; setAttr ($inMesh + ".intermediateObject") true; connectAttr ($inMesh + ".outMesh") ($membrane + ".inputMesh"); } else { connectAttr $inPlug ($membrane + ".inputMesh"); } connectAttr ($mesh + ".worldMatrix[0]") ($membrane + ".inputMatrix"); connectAttr -f ($membrane + ".outputMesh") $meshIn; setAttr ($mesh + ".quadSplit") 0; return $membrane; } global proc string [] createMembrane() { string $meshes[] = `ls -sl -dag -type mesh`; string $createdMembranes[]; int $numMeshes = size( $meshes ); if( $numMeshes < 1 ){ warning( (uiRes("m_createMembrane.kNoMeshSelected"))); return $createdMembranes; } int $i; for( $i = 0; $i < $numMeshes; $i++ ){ $createdMembranes[$i] = setupMembrane( $meshes[$i] ); } select -r $createdMembranes; return $createdMembranes; }