// =========================================================================== // 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. // =========================================================================== // // attach picked control nurbs curves to picked strokes // global proc bindCurvesToStrokes() { int $i, $j, $k; string $strokes[] = `ls -dag -sl -typ pfxGeometry`; string $curves[] = `ls -dag -sl -typ nurbsCurve`; for( $i = 0; $i < size( $strokes ); $i++ ) { string $existingConnections[] = `listConnections ($strokes[$i] + ".controlCurve")`; for( $j = 0; $j < size( $existingConnections ); $j++ ) { string $con[] = `listConnections ($strokes[$i] + ".controlCurve[" + $j + "]")`; for( $k = 0; $k < size( $con ); $k++ ) { disconnectAttr ($con[$k] + ".worldSpace") ($strokes[$i] + ".controlCurve[" + $j + "]" ); } } for( $j = 0; $j < size( $curves ); $j++ ) { string $node[] = `duplicateCurve -o false $curves[$j]`; if( size($node) > 0 ) { if( "nurbsCurve" == `nodeType $node[0]`) { connectAttr -f ($curves[$j] + ".worldSpace") ($strokes[$i] + ".controlCurve[" + $j + "]" ); } else { // TODO: check for existing curveFromSurface, rather than always creating new ones connectAttr -f ($node[0] + ".oc") ($strokes[$i] + ".controlCurve[" + $j + "]" ); } } } } }