// =========================================================================== // 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. // =========================================================================== // // Description : script to remove bogus lightLinks between defaultLightSet // and hyperGraphLayout. This script may take several minutes to // complete, depending on the number of links on your light // linker node. // // Warning : This is an example script, use at your own risk. // global proc cleanUpSpuriousLightLinks() { // Go through all the light links, and break the connections between // defaultLightSet and hyperGraphLayout. // string $linkers[] =`ls -type lightLinker`; int $numLinkers = size( $linkers ); int $indexLinkers = $numLinkers; while( $indexLinkers-- > 0 ){ string $linker = $linkers[$indexLinkers]; if( `reference -isNodeReferenced $linker` ){ // Light linker node is from a reference, can't cleanup // continue; } string $linkerPrefix = ($linker + ".lnk["); int $numLinks = `getAttr -size ($linker + ".lnk")`; int $indexLink = $numLinks; while( $indexLink-- > 0 ){ string $objectLink = ($linkerPrefix + $indexLink + "].object"); string $lightLink = ($linkerPrefix + $indexLink + "].light"); $hyperGraphLink = `connectionInfo -sourceFromDestination $objectLink`; if ($hyperGraphLink == "hyperGraphLayout.message") { $defaultLightLink = `connectionInfo -sourceFromDestination $lightLink`; if ($defaultLightLink == "defaultLightSet.message") { disconnectAttr $hyperGraphLink $objectLink; disconnectAttr $defaultLightLink $lightLink; } } } } }