[MayaAPI] Get all children under node

I’m having problems using MayaAPI, my task is to get all Shapes under transform node.
I’m able to list through children of selected Transform node using MFnDagNode::child command, but how do I search all levels.
I wonder if recursivity is needed or is there any appropriate function somewhere in API?

Thanks

You need to use one of the iterator classes with a filter to return only shapes :slight_smile:

The iterators have the prefix MIt*

http://download.autodesk.com/us/maya/2011help/API/class_m_it_dag.html

Use the reset method to set the object you wish to start traversing from (from selection or maybe command parameter etc)

Thanks for the hint, I’ve been struggling trying to make recursivity work, this looks simpler :slight_smile: