# Select Children & Deselect Parent?

**URL:** https://forum.highend3d.com/t/select-children-deselect-parent/3972
**Category:** Maya
**Tags:** mel
**Created:** [January 10, 2005, 8:25pm UTC](https://forum.highend3d.com/t/select-children-deselect-parent/3972 "2005-01-10T20:25:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![liz](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@liz](https://forum.highend3d.com/u/liz)
#### Post date: [January 10, 2005, 8:25pm UTC](https://forum.highend3d.com/t/select-children-deselect-parent/3972/1 "2005-01-10T20:25:52Z")

</div>

What's the best way of selecting all the children of your selection, then deselect the original selection/parent?

One more step beyond:

```
 select -hi ;
```

TIA!

---

<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: [January 10, 2005, 9:25pm UTC](https://forum.highend3d.com/t/select-children-deselect-parent/3972/2 "2005-01-10T21:25:57Z")

</div>

Best as a thing thats not defined in most cases! Define what you mean by children transforms only or shapes, intermediate objects or what? Anyway read the entry for list relatives

listRelatives -ad `ls -sl`; //return all descendants.

listRelatives -ad -type transform `ls -sl`; // transforms only (most people dont know or care that shapes exist)

Anyway you could prettymuch filter this list after the fact.

---

<div class="post-metadata">

### Author: ![liz](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@liz](https://forum.highend3d.com/u/liz)
#### Post date: [January 10, 2005, 10:25pm UTC](https://forum.highend3d.com/t/select-children-deselect-parent/3972/3 "2005-01-10T22:25:59Z")

</div>

The collision system for the game engine is determined by directly childing mesh/shape cubes to the game mesh.

For example, you have a table mesh. You then bind a cube that surrounds that mesh to act as the collision area, instead of the more complicated table mesh. These bounding boxes are stack down the tree.

Currently, there's a script that toggles some game options. It's hard to quickly tell what's been modified in the whole scene, however.

A solution would be to have the children change color in the hypergraph. This can be done by changing the state (making it non-interactive, similiar to a layer toggle).

To make it more automated, I was attempting to run the game option script, then have it only select the children (collision bounding) and toggle their state for a template color change.

Debugging the scene is quicker when you can immediately spot which collision boundings have been modified by the color change.

---

<div class="post-metadata">

### Author: ![liz](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@liz](https://forum.highend3d.com/u/liz)
#### Post date: [January 10, 2005, 11:16pm UTC](https://forum.highend3d.com/t/select-children-deselect-parent/3972/4 "2005-01-10T23:16:11Z")

</div>

Looks like I've got something here:

global proc ToggleColor ()

{  
 string $selected[] = `ls -sl`;  
 string $current = "";  
 string $object = "";  
 if ($selected[0] != "")  
 {  
 for ($current in $selected)  
 {  
 // Test current selection for transform objects  
 string $list[] = `listRelatives -c -pa -typ transform $current`;  
 if ($list[0] != "")  
 {  
 for ($object in $list)  
 toggle -te ($object); // Send current tranform object to setRenderAttr proc  
 }  
 else  
 {  
 toggle -te ($current); // Send current tranform object to setRenderAttr proc  
 }  
 }  
 }  
 else  
 {  
 error "Nothing selected.";  
 }  
}

---

<div class="post-metadata">

### Author: ![badmanjam](https://forum.highend3d.com/user_avatar/forum.highend3d.com/badmanjam/32/29_2.png) [@badmanjam](https://forum.highend3d.com/u/badmanjam)
#### Post date: [May 20, 2014, 5:54am UTC](https://forum.highend3d.com/t/select-children-deselect-parent/3972/5 "2014-05-20T05:54:50Z")

</div>

Ha! I've got it!

I want to Delete all the children of selected objects:

string $shapes[] = `listRelatives -ad`;  
delete $shapes;&nbsp;

Done!
