Last active
December 11, 2015 09:39
-
-
Save jhoolmans/4581607 to your computer and use it in GitHub Desktop.
Zeroes out all tip joints' orients axis.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Orient tip joint to parent | |
{ | |
proc string[] getChildren(string $nodes[]) | |
{ | |
return `listRelatives -f -c $nodes`; | |
} | |
proc int isTip(string $node) | |
{ | |
if (size(getChildren({$node})) > 0) | |
return 0; | |
else | |
return 1; | |
} | |
proc orientTipJointsToParent(string $nodes[]) | |
{ | |
for($obj in $nodes) | |
{ | |
string $tips[]; | |
// find tip joint | |
string $children[] = getChildren({$obj}); | |
if(size($children) == 0) | |
$tips[0] = $obj; | |
while(size($children) > 0) | |
{ | |
for($child in $children) | |
{ | |
if(isTip($child) == 1) | |
$tips[size($tips)] = $child; | |
} | |
$children = getChildren($children); | |
} | |
for ($tip in $tips) | |
{ | |
setAttr ($tip + ".jointOrientX") 0; | |
setAttr ($tip + ".jointOrientY") 0; | |
setAttr ($tip + ".jointOrientZ") 0; | |
} | |
select -r $tips; | |
} | |
} | |
string $selection[] = `ls -sl -type joint`; | |
orientTipJointsToParent($selection); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment