CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 05-29-2007, 08:28 PM   #1
godolinium
New Member
Tim Civil
Auckland, New Zealand
 
Join Date: Sep 2006
Posts: 4
simple not statement error.

Hi there, I hope someone can spare me the time of day for a rather noob question.

Ive been using mel since I started using Maya years ago but never more than to replicate functions I was seeing printed in the script editor window.

Im now trying to write a script to automate part of the animation process and keep finding holes in my mel vocab.

If I have a group in my scene called theGroupInMyScene (at the root level in my outliner)
and run the folowing script...

if( !`objExists ("theGroupInMyScene")` );

{
group -em;
rename"null1" "theGroupInMyScene";
};


rather than skiping the mel (like I would hope) it executes and creates a second group called theGroupInMyScene1.

If someone can shed some light on how to write an if else statement with a not opperator, inorder to test if a group exists I would really appreciate it

Ta
 
Old 05-30-2007, 08:55 AM   #2
Robert Bateman
Lord of the posts
 
Robert Bateman's Avatar
Robert Bateman
Software Engineer
United Kingdom
 
Join Date: Aug 2004
Posts: 1,160
Code:
if( !`objExists ("theGroupInMyScene")` ) { group -em; rename"null1" "theGroupInMyScene"; }


The ; after the if statement was the statement to be executed if the expression was true. The other code was therefore out of scope of the if statement and was always executing.
 
Old 05-30-2007, 08:55 AM   #3
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 07:34 AM.


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