If statement checks the attribute list?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  01 January 2011
If statement checks the attribute list?

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.
  01 January 2011
string $sel[] = `ls -sl`;
	if(!`getAttr -l ($sel[0]+".tx")`) setAttr ($sel[0]+".tx") (-`getAttr ($sel[0]+".tx")`);

seems to work fine.

Last edited by mlefevre : 01 January 2011 at 10:45 PM.
  01 January 2011
WOOOOOOOW, thats really cool.

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

Thank you a lot mlefevre.

  01 January 2011
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 09:32 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.