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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2006   #1
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
website: www.manuelmacha.de

 
Old 06 June 2006   #2
Hi,

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");

Aya~
__________________
I aim for my endless dreams and I know they will come true!
Download the Koshigaya Maya Script Suite from http://www.koshigaya.de

Last edited by AyaKoshigaya : 06 June 2006 at 02:29 PM.
 
Old 06 June 2006   #3
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 05:29 PM.


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