// =========================================================================== // 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. // =========================================================================== global proc MASHthaw() { //get the group string $parent[] = `ls -sl -tr`; //check that anything has been selected at all... if (size($parent) == 0) error "Please select a group that contains some objects.\n"; //delete history incase there are any loose transforms delete -ch; //get the seperated faces string $sel[] = `listRelatives -typ "transform" -children $parent[0]`; //check if there are any transforms. if (size($sel) == 0) error "Please select a group that contains some objects/transforms.\n"; //iterate for ($trans in $sel) { //parent to world in case the parent's location isn't 0,0,0 parent -w $trans; //center pivots and delete history CenterPivot; //get the pivot location to test if it is non zero float $pos[3] = `xform -q -rp $trans`; // if the local pivot isn't 0,0,0 if ($pos[0] != 0 || $pos[1] != 0 || $pos[2] != 0) { // freeze tranformations makeIdentity -a 1 $trans; //get the pivot location $pos = `xform -q -rp $trans`; //move the pivot to zero move -rpr 0 0 0 $trans; //freeze makeIdentity -a 1 $trans; //move the object to where the pivot was move -a $pos[0] $pos[1] $pos[2] $trans; //parent again parent $trans $parent[0]; } else { print ("Object \""+$trans+"\" is not frozen.\n"); } } }