CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 02-20-2013, 07:44 PM   #1
Kazem Ahmad
Join Date: Jul 2008
Posts: 120
Question MEL Beginner Problem

Hi ,

How to write a MEL code to custom Enum Attribute?

such as :

- Enum Attribute (Green , Blue)
if select "Green" then create a "sphere" .
if select "Blue" then create a "polyCube".

can you help me with a code ?

Old 02-21-2013, 03:28 AM   #2
Panupat's Avatar
Panupat Chong
Join Date: Feb 2004
Posts: 1,942
You have to use scriptnode and fire off command on attribute change. Not so simple for beginner I'm afraid.

If you're looking for simple solution, you should try either create 2 shelf buttons. Or a UI with 2 buttons.

Last edited by Panupat : 02-21-2013 at 03:32 AM.
Old 02-22-2013, 12:29 AM   #3
gmask's Avatar
Power Sitting
Topanga, USA
Join Date: Oct 2002
Posts: 6,937
you don't need a scriptnode.

create a sphere and add an enum attribute.

Then add an attribute called result to the sphere.

This will cause the expression to evaluate when you change the enum atttribute.

p, li { white-space: pre-wrap; }
if(pSphere1.test == 0){ pSphere1.result=pSphere1.test; print("0\n"); }else{ pSphere1.result=pSphere1.test; print("1\n"); }
blah blah blah
Old 02-22-2013, 06:19 AM   #4
Kazem Ahmad
Join Date: Jul 2008
Posts: 120
Thank you Panupat .

Thank you gmask .very appreciate . it's working
Old 02-22-2013, 06:19 AM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,479
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:47 AM.

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