// =========================================================================== // 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. // =========================================================================== // setLineModifierFillObject // // This connects the selected mesh to the selected paint effects line modifier. // The occupy attract will then attract only to points that are inside this mesh. // The sense of inside/outside of the mesh is defined by its normals. global proc setLineModifierFillObject() { int $i; string $mesh[] = `ls -sl -dag -type mesh`; string $lineMod[] = `ls -sl -dag -type lineModifier`; if( size($mesh) == 0 && size( $lineMod ) == 1 ){ string $input = ($lineMod[0]+".inputMesh"); string $con = `connectionInfo -sfd $input`; if( size( $con ) > 0 ){ disconnectAttr $con $input; // if only line modifier selected and it has a connection break it return; } } if( size( $mesh )!= 1 || size( $lineMod ) != 1 ){ string $mess = (uiRes("m_setLineModifierFillObject.kLineModNeedsSelection")); warning $mess; return; } if( getAttr( $lineMod[0] + ".occupyAttraction" ) == 0 ){ setAttr ( $lineMod[0] + ".occupyAttraction" ) 20.0; setAttr ( $lineMod[0] + ".widthScale" ) 1.0; setAttr ( $lineMod[0] + ".shape" ) 1; removeMultiInstance -break true ($lineMod[0] +".dropoff[1]"); } connectAttr -f ($mesh[0]+".worldMesh[0]") ($lineMod[0] + ".inputMesh"); }