PDA

View Full Version : Joe Harkins Mel script conversion help


jason108
09-12-2007, 09:20 AM
I'd like to use this mel script below to create nurb circles for each FBIK effector so that i have zero'd out handles to animate with. I was wondering if anyone could alter this script so that it would work for effectors and not joints?




I hope this is ok to do this. If it's not I apologize.




thanks

Jason














author: Joe Harkins www.creaturetd.com

name: controlCircleCreator

date: 07/20/05



description:

creates a nurbs circle controller for each selected object based on a few user input args

parents the shape of the circle to each object and sets display override based on naming tokens



arguements:

string $sel[] = list of selected objects

float $x = the direction it should face in X

float $y = the direction it should face in Y

float $z = the direction it should face in Z

float $r = the radius for the circle



example:

select the objects in the scene you wish to create controls for

run this from the command line:

controlCircleCreator `ls -sl` 1 0 0 .25;



*/

//-----------------------------------------------------------------------------------------------



global proc controlCircleCreator (string $sel[], float $x, float $y, float $z, float $r){

string $joint;

for ($joint in $sel){

float $loc[] = `xform -q -ws -t $joint`;

circle -fp $loc[0] $loc[1] $loc[2] -sw 360 -nr $x $y $z -r $r -n ($joint + "_control");

parent -r -shape ($joint + "_controlShape") $joint;

setAttr ($joint + "_controlShape.overrideEnabled") 1;

setAttr ($joint + ".overrideEnabled") 1;



if(`gmatch $joint "*cn*"`){

// if center color override is yellow

setAttr ($joint + "_controlShape.overrideColor") 17;

setAttr ($joint + ".overrideColor") 17;

}

else if(`gmatch $joint "*lf*"`){

// if left color override is green

setAttr ($joint + "_controlShape.overrideColor") 14;

setAttr ($joint + ".overrideColor") 14;

}

else if(`gmatch $joint "*rt*"`){

// if right color override is red

setAttr ($joint + "_controlShape.overrideColor") 13;

setAttr ($joint + ".overrideColor") 13;

}

else if(`gmatch $joint "*"`){

// if cant match, make blue

setAttr ($joint + "_controlShape.overrideColor") 6;

setAttr ($joint + ".overrideColor") 6;

}



delete ($joint + "_control");

}



}



//puts selected objects in reference mode

//

global proc makeReference(string $sel[]){



string $obj;



for($obj in $sel){

setAttr ($obj + ".overrideEnabled") 1;

setAttr ($obj + ".overrideDisplayType") 2;

}

}

jason108
09-12-2007, 06:52 PM
actually i don't think this is a good idea. the effectors have more info on them then i realized.

thanks
Jason

CGTalk Moderation
09-12-2007, 06:52 PM
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.