// =========================================================================== // 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. // =========================================================================== // // // Creation Date: September 19, 1997 // // // // Procedure Name: // parentPreset // // Description: // Performs parent command. // // Return Value: // None. // global proc parentPreset(int $add, int $preserve) { string $cmd = "parent"; if ($add) $cmd += " -add"; if (!$preserve) $cmd += " -r"; if ($preserve) { string $item; int $grouped = 0; string $obj[] = `ls -sl -type transform`; // Note: the following loop skips the last object (target object) // for ($i = 0; $i < size($obj)-1; ++$i) { $item = $obj[$i]; string $conn[] = `listConnections -s false ($item+".wm")`; if (size($conn) > 0) { if (size(ls("-type","cluster",$conn)) > 0) { string $groupMsg = "group "+$item+"; " ; print($groupMsg); $obj[$i] = `group $item`; $grouped = 1; } } } if ($grouped) { print "select"; for ($item in $obj){ print (" " + $item); } print "; "; select $obj; print($cmd + ";\n"); eval($cmd); warning (uiRes("m_parentPreset.kClustersGrouped")); return; } } evalEcho($cmd); }