Skip to content

Instantly share code, notes, and snippets.

@jhoolmans
Last active December 11, 2015 09:39
Show Gist options
  • Save jhoolmans/4581607 to your computer and use it in GitHub Desktop.
Save jhoolmans/4581607 to your computer and use it in GitHub Desktop.
Zeroes out all tip joints' orients axis.
// 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