Here's a really simple script I threw together for an animator that zeros out all visible and keyable attributes on objects. It ignores visibility and scale, and any non-scalar (numeric) attributes.
Great for getting a character back into his or her neutral position.
Download Here:
jgZeroOutAttrs.mel
Great tool!
ReplyDeleteSaves a lot of boring work.
This comment has been removed by the author.
ReplyDeleteI made it so it only does rotation now too
ReplyDeleteI added my name to the script update.
// Zeros out all Visible/Keyable Attributes On Selected Object(s)
// Author: Jay Grenier, 2010 and gary eller 2014
// Last Update: May 6th, 2010 july 21 2014
// Notes: Source script, select object, hit button. Or, make a shelf button that calls jgZeroOutAttrsDo For help email jay@jaygrenier.com
// **********************************************************
// Zeros out all Visible/Keyable Attributes On Select Object(s)
global proc jgZeroOutAttrsDo () {
// Get Selected
string $sel[] = `ls -sl` ;
// Loop
for($item in $sel) {
// Get All Attributes
string $attrs[] = `listAttr -v -k -s $item` ;
// Zero Out (Not Visibility or Scale)
for ($attr in $attrs) {
if($attr != "visibility" && $attr != "scaleX" && $attr != "scaleY" && $attr != "scaleZ" && $attr != "translateX" && $attr != "translateY" && $attr != "translateZ") {
string $path = ($item+"."+$attr) ;
if(!`getAttr -l $path`) setAttr ($item+"."+$attr) 0 ;
}
}
}
}
// **********************************************************
// Zero Out GUI
global proc jgZeroOutAttrs () {
// Delete and Prefs
if (`window -exists jgZeroOutWin`) {
deleteUI jgZeroOutWin;
windowPref -removeAll jgZeroOutWin ;
}
//Define basic window specs
window
-w 100
-rtf true
-t ""
jgZeroOutWin ;
columnLayout
-adjustableColumn true
-rowSpacing 6
-columnOffset both 6;
button
-h 30
-bgc .75 .905 1
-l "Zero Out"
-c "jgZeroOutAttrsDo ;" ;
showWindow jgZeroOutWin ;
} jgZeroOutAttrs ;