ifVisible
This script is designed to be used as an itemFilter for the ‘lsThroughFilter’ MEL command. It filters the input list to return only those objects
which are currently Visible. Heirarchal visibility
is computed -- if a node's parent is not visible,
it won't be either.
First, prepare the itemFilter. You only have to do this once per Maya session.
itemFilter -byScript ifVisible ifVisible;
You may then use the filter with the ‘lsThroughFilter’ MEL command:
lsThroughFilter ifVisible;
See Maya's documentation on itemFilters for more information.