I'm very new to MEL, but I have wracked my brain already with "MEL scripting for Animators', the Maya online DOCS, and this forum - and to help prevent from going insane I thought I'd post my question/problem here:
In english:
1) I want to create an array of objects
2) access any element in the array (say [4])
3) and save the translate values of that object into a variable.
4) then apply those translation values BACK to that same object (sometime in the future).
What I'm attempting to do is create a script that remembers the translation values of a hierarchy of joints/objects, and then puts the joints back to their original positions later on. Yes - it sounds like bind pose.
To begin with, I've been trying to figure how to simply get translation info from ONE object in array, put that info into a variable, move the object, then apply the translation values stored in the variable. Is that asking for so much!?
What I've tried (among 10 million other things):
string $myobjects[] = ls -sl
;
float $my_object2_translate = getAttr $myobject[2].translate;
Of course that doesn't work. But I was able to do this, but don't know if it helps:
float $mid_translate[] = getAttr ($one[2]+".translate");
// Result: 0 -1.953386 0 //
Ok, I created an array that is storing 3 values - uhm, now what?
Answers in the form of completed and working Mel Scripts are also welcome.
Thanks in advance.