NavHeader
journalHeader

Wednesday, July 7, 2010

Back to that hacking other people's scripts and other things....

Been working on cleaning things up on the facial rig to final it.

  • Took Morphy to the dentist to hopefully fix that teeth penetrating the cheek issue (painful!)
  • Added Cheek up/dn/forward/back poses at the request of one of my buddies (whose site I would be happy to link to if he had one to point me to...hint...Rick...:)
  • Started getting rid of all the expressions driving the facial rig and going totally nodal. In doing so I'm hacking jsFacialWin as I pointed out last week. So, to aid that little endevour with as many controls as I have. I scripted the process of adding the necessary nodes, renaming and reverting the names. Took a page out of the author of that awesome scripts book in using string attributes for storing variables for later use. Neato! Here it is if you might find it useful...
The process for that is:
  1. Source my script
  2. to input the starter variables when you call the script such as
    jbFacialGUITricker ("circle_anim", "circle_anim_grp", "C");
    In this case "circle_anim" is the joystick itself, "circle_anim_grp" is it's parent transform group, and "C" is the type of joystick control I want it to emmulate. 
  3. After you're done, select the anim control you wanna "reset" and type "global proc jbFacialGUITrickerClean"
/*variables needed

Script to trick jsFacialwin to using other "joysticks"
Sample input:
jbFacialGUITricker ("circle_anim", "circle_anim_grp", "C");

There's no error checkin cause this is mainly for me:)

*/

global proc jbFacialGUITricker (string $control, string $group, string $type)
{
string $controlAttr;
string $grpAttr;

//renames the controls
string $controlNewName = `rename $control ($control + "CircleCtrl")`;
string $groupTempName = `rename $group ($group + "Grp")`;

//adds our new attributes for the control window to work
addAttr -ln "name" -dt "string" $controlNewName;
addAttr -ln "type" -dt "string" $groupTempName;

//sets those new attributes
setAttr -type "string" ($controlNewName+".name") $control;
setAttr -type "string" ($groupTempName+".type") $type;

//renames the group to the proper format in an inefficient manner (that works)
select $groupTempName;
searchReplaceNames "_grpGrp" "Grp" "selected";

$groupNewName = `ls -sl`;

//adds our undo attributes to pull all this stuff out
addAttr -ln "originalGroup" -dt "string" $controlNewName;
addAttr -ln "newName" -dt "string" $controlNewName;
addAttr -ln "newGroup" -dt "string" $controlNewName;

//sets the attributes for jbFacialGUITrickRemove storing variables for another script
setAttr -type "string" ($controlNewName+".originalGroup") $group;
setAttr -type "string" ($controlNewName+".newName") $controlNewName;
setAttr -type "string" ($controlNewName+".newGroup") $groupNewName;


print "Done";
}

global proc jbFacialGUITrickerClean ()
{
string $originalName;
string $originalGrp;
string $newName;
string $newGrp;

//gets attributes from our selected control
$control = `ls -sl`;

$originalName = `getAttr ($control[0]+".name")`;
$originalGrp = `getAttr ($control[0]+".originalGroup")`;
$newName = `getAttr ($control[0]+".newName")`;
$newGrp = `getAttr ($control[0]+".newGroup")`;

//renames our controls to the proper names
rename $newName $originalName;
rename $newGrp $originalGrp;


}


Optimization stuff isn't exactly the most exciting...

No comments:

All the stuff on this site is 2000 - by Josh Burton...unless otherwise noted. All rights reserved.