This script has probably already been written by someone, but I couldn't find it, and its something I do alot of in character rigging, so I figured it would be a good tool to start with in my early beginnings of learning MEL.
The idea behind it is that I'd like to snap the pivot point of one object to the pivot point of another object. Yes, I realize that this is a rather quick thing to do in Maya manually, but I do it so much that having a hotkey, or shelf button to speed it up would be great in the long run.
How I thought it could work is that first you would pick the object whose pivot you would like to snap somewhere, and then pick the object whose pivot you are snapping the previous pivot to. Then run the mel script and the first object's pivot snaps to the second objects pivot point. here is what I have so far:
// get a list of the selected objects
$selected = `ls -sl`;
//find out the pivot point of the second selected object
vector $pivot = `xform -q -piv $selected`;
//move pivot of object 1 to pivot of object 2
move $pivot $selected.scalePivot $selected.rotatePivot;
Looking at it, it makes sense to me, but obviously i'm not getting it to work properly. I just don't know enough. Any direction any of you guru's can give would be awsome. Thanks for your time.