// =========================================================================== // 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. // =========================================================================== // loadRelatedReferences.mel // // find the reference nodes related to the selected items, // and load them if they're not already loaded // global proc int loadRelatedReferences ( ) { string $selNodes[] = `ls -sl`; // if a reference node is selected, just load it // if an annotation, or locator, or their parent is selected // look for a connected reference node and load it. // For a first crack at this, I'm checking if each reference // is loaded, and if it's not then I load it // TODO - do we get better performace if we collect the reference nodes // sort them, and only try to load each one once? - JP string $selNode; string $refNode; for ($selNode in $selNodes) { $refNode = `getRelatedReference $selNode`; if(size($refNode) > 0 ) { if( `file -rfn $refNode -q -dr` ) { file -lr $refNode; } } } return 0; }