# Bug with deleteAttr on color attributes?

**URL:** https://forum.highend3d.com/t/bug-with-deleteattr-on-color-attributes/6876
**Category:** Maya
**Tags:** mel
**Created:** [September 20, 2001, 4:01am UTC](https://forum.highend3d.com/t/bug-with-deleteattr-on-color-attributes/6876 "2001-09-20T04:01:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [September 20, 2001, 4:01am UTC](https://forum.highend3d.com/t/bug-with-deleteattr-on-color-attributes/6876/1 "2001-09-20T04:01:33Z")

</div>

It seems that if you have two attributes added with the -useAsColor flag, you cannot delete one and add the attribute back with the same name or Maya produces a "too many children on this compound" error. Can anyone repeat this? Anyone have a workaround?  
Try this. Create a material named phong1 and select it. Now run...

* * *

//First attribute  
addAttr -ln test -uac -at float3;  
 addAttr -ln testR -at "float" -p test;  
 addAttr -ln testG -at "float" -p test;  
 addAttr -ln testB -at "float" -p test;  
//Second attribute  
addAttr -ln new -uac -at float3;  
 addAttr -ln newR -at "float" -p new;  
 addAttr -ln newG -at "float" -p new;  
 addAttr -ln newB -at "float" -p new;  
//Delete second attribute  
deleteAttr "phong1.new";  
//\*\*\*Try to re-add second attribute (exactly the same as above)  
addAttr -ln new -uac -at float3;  
 addAttr -ln newR -at "float" -p new;  
 addAttr -ln newG -at "float" -p new;  
 addAttr -ln newB -at "float" -p new;

* * *

The addAttr, deleteAttr, re- addAttr process works when only a single compound color attribute is present. Any thoughts?

--JeffD

---

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [November 2, 2004, 5:54pm UTC](https://forum.highend3d.com/t/bug-with-deleteattr-on-color-attributes/6876/2 "2004-11-02T17:54:11Z")

</div>

Hey Jeff

just for the record (three years late!)... Rename the attrib before deleting it...

global delAttr (string $obj, string $attr)  
{  
renameAttr ($obj+"."+$test) "deleteme";  
deleteAttr ($obj+".deleteme");  
}

---

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [November 3, 2004, 3:19pm UTC](https://forum.highend3d.com/t/bug-with-deleteattr-on-color-attributes/6876/3 "2004-11-03T15:19:31Z")

</div>

Ugh. Yeah, it is a little late for me now ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/tongue.gif)

--JeffD
