
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all. So I have a hotkey that I recently set up that zeroes out the translation of an object that I have selected, and I'm absolutely loving it. But the way I had it set up before, I wasn't able to use it for any object that I had with a locked axis. I'm working on a facial rig right now and I would definitely want to be able to use it for those controllers as well.
So I attempted to add a getAttr command with a -settable flag to run a check before the script tries to set an attribute, but I've been getting an invalid use error. I can use the flag no problem if I point to a specific object, but I don't know how to use it yet when dealing with $item. Can someone point me in the right direction?
Here's the script I'm trying to run:
string $array[] = `ls -sl`;
int $Xlock;
int $Ylock;
int $Zlock;
for ($item in $array)
{
$Xlock = getAttr -se ($item + ".translateX");
$Ylock = getAttr -se ($item + ".translateY");
$Zlock = getAttr -se ($item + ".translateZ");
if($Xlock != 0)
{
setAttr ($item + ".translateX") 0;
}
if($Ylock != 0)
{
setAttr ($item + ".translateY") 0;
}
if($Zlock != 0)
{
setAttr ($item + ".translateZ") 0;
}
}
Solved! Go to Solution.