# Retrieving Names Of Enum Attribute Items

**URL:** https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485
**Category:** Maya
**Tags:** mel
**Created:** [December 1, 2005, 4:56pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485 "2005-12-01T16:56:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![daniel-faust](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@daniel-faust](https://forum.highend3d.com/u/daniel-faust)
#### Post date: [December 1, 2005, 4:56pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/1 "2005-12-01T16:56:12Z")

</div>

Hi.

I need to store the names of all avaliable items of an enumeration attribute into a string array, so that I can build a popup menu containing those items.

I can't find a command, and "getAttr -as ..." only returns the name of the currently selected item ☹

Thanks in advance,

Daniel

---

<div class="post-metadata">

### Author: ![ewerybody](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/e/bcef8e/32.png) [@ewerybody](https://forum.highend3d.com/u/ewerybody)
#### Post date: [December 1, 2005, 5:14pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/2 "2005-12-01T17:14:37Z")

</div>

QUOTE  
names of .. items of an enumeration attribute  
what do you mean?

Objects that have a special attribute?

take all objects and seek them for that attribute.  
CODE  
string $nameArray[];  
string $all[] = `ls`;  
for ($item in $all){  
 &nbsp; &nbsp;if (`attributeExists attribName $item`){  
 &nbsp; &nbsp; &nbsp; &nbsp;$nameArray[size($nameArray)] = $item;  
 &nbsp; &nbsp;}  
}  
Or am I missunderstanding you? ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/mellow.gif) I'm not familiar with enumeration attributes.

---

<div class="post-metadata">

### Author: ![daniel-faust](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@daniel-faust](https://forum.highend3d.com/u/daniel-faust)
#### Post date: [December 1, 2005, 5:29pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/3 "2005-12-01T17:29:50Z")

</div>

No. I mean that I have a node which has an attibute which is an enumeration attribute, like the the lambert1.type.

I want a function like the getAllItems below:

CODE  
string $array[] = getAllItems( lambert1.type );

optionMenu -label "Type for lambert1";

for(int $i = 0; $i \< size($array); $i++ )  
 &nbsp;menuItem -label $array[i] -c ("selectIndex(" + $i + ");");

Or some other way to make the contents of the enumeration attribute visible and selectable in the dagMenu (the one which pops up when you right click a node)

Thanks in advance,  
Daniel

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [December 1, 2005, 5:50pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/4 "2005-12-01T17:50:30Z")

</div>

ls -type lambert;

TIP you can use ls -sl -st to show what type some selected node is

---

<div class="post-metadata">

### Author: ![daniel-faust](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@daniel-faust](https://forum.highend3d.com/u/daniel-faust)
#### Post date: [December 1, 2005, 6:02pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/5 "2005-12-01T18:02:05Z")

</div>

arghhh

nurbsSphereShape1.curvatureTolerance as in

```
sphere; 
getAttr -as nurbsSphereShape1.curvatureTolerance;
// Result: Medium Quality //
```

instead of lambert1.type.

CODE  
sphere;   
string $array[] = getAllItems(nurbsSphereShape1.curvatureTolerance);

optionMenu -label "Curve tolerance options for nurbsSphereShape1";

for(int $i = 0; $i \< size($array); $i++ )  
 menuItem -label $array[i] -c ("selectIndex(" + $i + ");");

Thnx in advance,  
Daniel

---

<div class="post-metadata">

### Author: ![failure](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/f/f08c70/32.png) [@failure](https://forum.highend3d.com/u/failure)
#### Post date: [December 1, 2005, 6:17pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/6 "2005-12-01T18:17:21Z")

</div>

If attribute is custom you can use

CODE  
addAttr -q -enumName nurbsSphere1.attribute;

---

<div class="post-metadata">

### Author: ![daniel-faust](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@daniel-faust](https://forum.highend3d.com/u/daniel-faust)
#### Post date: [December 1, 2005, 6:20pm UTC](https://forum.highend3d.com/t/retrieving-names-of-enum-attribute-items/3485/7 "2005-12-01T18:20:10Z")

</div>

Never mind, I wrote a new mel command (api).

Thanks anyway.

Was there an already existing solution to it?  
\_\_EDIT\_\_\_  
Nope, was not a dynamic one.  
\_\_/EDIT\_\_\_

Regards,  
Daniel
