PDA

View Full Version : Is there a better way?


Me109
05-06-2007, 07:39 AM
http://www.jamietelford.com/bin/foot_rig_01.gif

Above is what I'm doing.. basically re-assigning the parent in this foot setup so that I can animate the foot from the toe or the heel...

Here's the code..


global proc flipParent()
{
string $nodes[] = `ls -sl`;
$testNodes = $nodes[0];
switch ($testNodes)
{
case "R_Heel_CTRL":
Unparent R_Heel_CTRL R_Toe_CTRL;
parent R_Toe_CTRL R_Heel_CTRL;
select R_Heel_CTRL;
break;
case "R_Toe_CTRL":
Unparent R_Toe_CTRL R_Heel_CTRL;
parent R_Heel_CTRL R_Toe_CTRL;
select R_Toe_CTRL;
break;
case "L_Heel_CTRL":
Unparent L_Heel_CTRL L_Toe_CTRL;
parent L_Toe_CTRL L_Heel_CTRL;
select L_Heel_CTRL;
break;
case "L_Toe_CTRL":
Unparent L_Toe_CTRL L_Heel_CTRL;
parent L_Heel_CTRL L_Toe_CTRL;
select L_Toe_CTRL;
break;
}

}
scriptJob -e "SelectionChanged" flipParent;

Is there a better way of doing this? this code works ok.. except

cannot undo the previous transform after I've changed the parent/child relationship..
the parent operation moves everything involved in this operation down into the world.. which ruins any 'main character control' i have setup..
Thanks for any help!

Me109
05-06-2007, 09:52 AM
Improved the operation by getting rid of the Unparent
and replaced with just a parent..


global proc flipParent()

{

string $nodes[] = `ls -sl`;

$testNodes = $nodes[0];

switch ($testNodes)

{

case "R_Heel_CTRL":

parent R_Heel_CTRL MainCTRL;

parent R_Toe_CTRL R_Heel_CTRL;

select R_Heel_CTRL;

break;

case "R_Toe_CTRL":

parent R_Toe_CTRL MainCTRL;

parent R_Heel_CTRL R_Toe_CTRL;

select R_Toe_CTRL;

break;

case "L_Heel_CTRL":

parent L_Heel_CTRL MainCTRL;

parent L_Toe_CTRL L_Heel_CTRL;

select L_Heel_CTRL;

break;

case "L_Toe_CTRL":

parent L_Toe_CTRL MainCTRL;

parent L_Heel_CTRL L_Toe_CTRL;

select L_Toe_CTRL;

break;

}



}

scriptJob -e "SelectionChanged" flipParent;



Solved one of my problems

wat2k
05-06-2007, 10:27 AM
Why don't u simply use reverse foot setup?

tbaypaul
05-08-2007, 07:06 PM
for 30 bucks you get the source code to ILM's new plugin ...it does exactly what you want....called bi-directional constraints......anything can be a driver or be driven in turn by simple selection.

http://estore.autodesk.com/dr/v2/ec_Main.Entry17C?SID=19515&SP=10023&CID=134779&PID=915353&PN=1&V1=915353&V2=&V3=&V4=&V5=11033743&CUR=840&DSP=&PGRP=0&ABCODE=&CACHE_ID=248742

Sick Spider
05-09-2007, 07:31 PM
Just have a rig with two, or more pivot points (grouping the IKs), one for heel one for toe Etc'...
Much more simple, no code needed....

tbaypaul
05-10-2007, 01:22 AM
I did a poor job of explaining bi-directional constraints, so I feel compelled to elaborate..... it is a means to breaking the cyclecheck warning you get when there is a loop in the dependency graph....so a "pirate" sword can drive and be driven by the hand/arm rig, without the usual rigging you need to do that type of dynamic "parenting".

For the animator, all they have to do is select the thing they want to move and it becomes the driver of the constraint. This happens as a matrix transformation so it is completely independent of any arbitary hierarachies that the objects may exist in. Plus it is easy and clean in the scene graph.....select all the objects, execute the command and you are done.

Me109
05-10-2007, 02:29 AM
wow! thx guys for all the input... very cool!

I'll check out that plugin for sure... at least for a few coding tips..
yeah.. the foot setup I have is a reverse IK, I just wanted some extra functionality built into the handles so my animators (students) can concentrate on the 'art' of animation itself..

this setup kinda worked pretty good.. except my tests revealed that unparenting and reparents screws up the transforms relative to each other.. so eventually the controllers shift position and a screw everything up..

Looks like for the meantime that I'll scrap the code and stick with a simple RIK setup..

Thx for all the replys!

Buexe
05-10-2007, 08:51 AM
I remember reading on the website of the author that his solution is all cool, except that it has problems when this relationship is animated. Maybe they fixed it by now. Can`t find the link at the moment though...

CGTalk Moderation
05-10-2007, 08:51 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.