//////////////////////////////////////////////////////////////////////////////////////////// // Script: mmIsolateAsset 1.0 // // Description: Pick one or multiple objects and execute the following command: // // mmIsolateAsset(); // // If objects are in a hierarchy, the entire hierarchy of the // // selected objects will be isolated in the currently active // // viewport. // // Author: Manuel Macha | www.manuelmacha.de |manuel@manuelmacha.de // //////////////////////////////////////////////////////////////////////////////////////////// global proc mmIsolateAsset() { string $objInSel[] = `ls -long -sl`; //query currently selected object's long name string $objInSelShort[] = `ls -sl`; //query currently selected object's short name int $numObjInSel = size($objInSel); //size of the array string $parentOfObjInSel[]; string $activePanel = `getPanel -withFocus`; //get the active panel int $activePanelState; string $activePanelType = `getPanel -typeOf $activePanel`; string $buffers[]; int $numBuffers; if ($activePanelType == "modelPanel") { $activePanelState = `isolateSelect -query -state $activePanel`; //get the active panel's state select -cl; //clear the current selection for ($i = 0; $i < $numObjInSel; $i++) { $numBuffers = `tokenize $objInSel[$i] "|" $buffers`; select -add $buffers[0]; //select each parent } enableIsolateSelect $activePanel (!`isolateSelect -query -state $activePanel`); select -cl; //clear the current selection for ($k = 0; $k < $numObjInSel; $k++) { select -add $objInSelShort[$k]; //select each parent } } else { warning ("// " + $activePanel + " is of type " + $activePanelType + ". Please select a modelPanel.\n"); } }