PDA

View Full Version : Mel Scripting / Expression help!


ericz
04-29-2008, 12:37 AM
Hey,

I've created an FK/IK switch for the arm of my character. I used the "Third Arm" script at HighEnd3D. Now, my problem is that while it switches perfectly between the two, for animation purposes, you need to 'snappy' the IK controller over the FK controller for it to appear seamless when it's switched. Right now how it works is the BND arm moves instantly to the FK from the IK when I click from 0 to 1 in my attribute. This is all well and good and all it means is that I have to make another step while animating to make it seamless, but I was wondering if it were possible at all to create an expression in my FKIK attribute that does the work for me. Essentially, when I switch from 0 to 1 on my FKIK attribute, can I create an expression for it that says:

select -cl ;
select -r wrist_CTRL ;
select -tgl L_armIk_CTRL ;
string $selected[] = `ls -sl`;
pointConstraint -n tmpPoint $selected[0] $selected[1];
orientConstraint -n tmpOrient $selected[0] $selected[1];
delete tmpPoint tmpOrient;

How would add this script as an expression so that it does this when I toggle between 0 and 1 in the FKIK attribute?

Thanks!

Boucha
04-29-2008, 04:23 AM
IKFK snapping is an added bonus for created an animator freindly rig. As far as I have known, I have not yet found any rig that provide IK FK snap while blending. It just doesn't make sense. Animators should have a flexibility for easily blending between the two. On the other hand, IK FK snapping is good for quick posing of charater saving a lot of time. So I suggest that you create a simple MEL which is executed each time the file is loaded. To do that you can just create an expression by script Node Name. The snapping is basically done by using Mel commands such as getAttr and setAttr or xform. Then, you can provide a shelf button to quickly execute the snappin process...

CGTalk Moderation
04-29-2008, 04:23 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.