MEL Script: Reset Translations
25May10
Tonight I wrote a script that performs a function that I have been wanting for a long time. It resets the translation numbers to the distance that the object is from the origin. So, for example, your object is sitting out in the middle of nowhere, and it has translations of 0 0 0. What you need to know is what this object’s translations would be if it had been created at the origin, then moved out in to space. Well, just run this procedure and it will reset translations to what they would be.
Maybe that doesn’t make sense, but here is the script.
proc resetTranslations()
{
string $selected[] = `ls -sl` ;
$resetTransformOBJ01=$selected[0];
CenterPivot;
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
string $selected[] = `ls -sl` ;
$oldSpotOBJ01=$selected[0];
delete `pointConstraint $resetTransformOBJ01 $oldSpotOBJ01`;
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
string $selected[] = `ls -sl` ;
$originOBJ01=$selected[0];
delete `pointConstraint $originOBJ01 $resetTransformOBJ01`;
select -r $resetTransformOBJ01 ;
FreezeTransformations;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0;
delete `pointConstraint $oldSpotOBJ01 $resetTransformOBJ01`;
delete $oldSpotOBJ01;
delete $originOBJ01;
}
I hope that helps someone!
-Pete
Filed under: Uncategorized | 2 Comments

Sounds really cool, Pete! Ahhh…makes me want to pick up my old dupliverts script and work on it.
Nice! Very useful script.