how to query no. of possible entries of enum attribute?

Become a member of the CGSociety

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

Thread Tools Display Modes
  06 June 2006
how to query no. of possible entries of enum attribute?

lets say i have a sphere with an extra attribyte of type "enum" ...

sphere -n mySphere;
addAttr -ln colors -at "enum" -en "Green:Blue:Red:Black:White" mySphere;
setAttr -e -keyable true mySphere.colors;

how can i query, the total number of possible values of mySphere.colors

hope i made myself clear. i want maya to return "5", as thats the no. of colors to choose from in my example.

many thanks for your help in advance!
Manuel Macha

  06 June 2006

you can -query the addAttr Command to retrieve the -max value for the Count and the -en value for the name-string.

proc printEnums(string $nodeAttr) {
  string $enums[];
  string $attr = `addAttr -q -en $nodeAttr`;
  tokenize $attr ":" $enums;
  print ("EnumCount: " + (`addAttr -q -max $nodeAttr` + 1) + "\n");
  print "EnumNames: ";
  for ($i = 0; $i < size($enums) - 1; $i++)
	print ($enums[$i] + ", ");
  print ($enums[`size($enums)` - 1] + "\n");
} printEnums("mySphere.colors");

I aim for my endless dreams and I know they will come true!
Download the Koshigaya Maya Script Suite from

Last edited by AyaKoshigaya : 06 June 2006 at 02:29 PM.
  06 June 2006
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 04:25 PM.

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