Maya Python API 1.0 Question about SelectionLists

I have a custom plugin command that works on vertices from the current selection. It works fine, but if an object is selected in object mode, then it just skips the object instead of operating on all of the vertices.

Ideally I’d like to operate on the entire object if it’s selected, otherwise operate on the selected verts.

Here is a snippet:


    def doIt(self, args):
        argData = om.MArgDatabase(self.syntax(), args)
        selList = om.MSelectionList()
        argData.getObjects(selList)

        selListIter = om.MItSelectionList(selList, om.MFn.kMeshVertComponent)
        compListFn = om.MFnComponentListData()
        compListFn.create()

        while not selListIter.isDone():
            dagPath = om.MDagPath()
            component = om.MObject()
            selListIter.getDagPath(dagPath, component)
            # stuff
            selListIter.next()

Thanks!

Edit: from the docs on MItMeshVertex it sounds like it should iterate over all the vertices if none are provided:

The iterator functions in two modes depending on whether a component is specified. When a component is not given or is NULL the iteration will be over all vertices for the polygon. When a component is given this iterator will iterate over the vertices specified in the component. When iterating over components a DAG path to the surface must also be supplied.

Maybe it’s a naive approach but I like to have all my inputs sorted and in the right format before I run my calculation functions, so personally, I’d run a “PolySelectConvert 3” (I think that’s the command) to convert object selections to vertices before creating the selectionList.