Selecting Objects

Today I’ll show how to use Maya’s API to select objects based on their type.

So you want to select an object based on its type? The first thing to look at is how to iterate over dag nodes. This is best done with MItDag. MItDag takes two arguments. The first is the traversal type which tells the iterator how to walk over the hierarchy when doing its search. The second is a function set filter. Basically MItDag grabs each object as it traverses the scene hierarchy and checks if the object has the function set specified as the filter.

Here’s an example of how to use MItDag.