PDA

View Full Version : If statement checks the attribute list?


eYadNesS
01-06-2011, 08:11 PM
I wrote a simple flipping translateX script, the problem if the translateX is locked I got a warning message, and the script do not proceed .

How I can write an if statement to check if my translateX is lock or not, if its "not" do the flipping, if "yes" skip it.

i know how to write if statements, just i don't know the commands to check the attribute list.

This is a part of my script:

$selectObjectFlip =`ls -sl`;
float $translateX = `getAttr $selectObjectFlip.translateX`;
string $getTranlateX = $selectObjectFlip[0] + ".translateX";
setAttr $getTranlateX ($translateX * -1);

Thank you in advance.

mlefevre
01-06-2011, 09:40 PM
string $sel[] = `ls -sl`;
if(size($sel))
if(!`getAttr -l ($sel[0]+".tx")`) setAttr ($sel[0]+".tx") (-`getAttr ($sel[0]+".tx")`);

seems to work fine.

eYadNesS
01-06-2011, 09:56 PM
WOOOOOOOW, thats really cool.

My script was so stupid, i'm new in mel scripting :rolleyes:

Thank you a lot mlefevre.

:thumbsup:

CGTalk Moderation
01-06-2011, 09:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.