The add() method on MSelectionList combined with MGlobal::setActiveSelectionList() provides one method for a plug-in to modify the active selection list.

Another way is to use MGlobal::selectByName(). This finds all objects matching a pattern and adds them to the active selection list. For example:

MGlobal::selectByName( "*Sphere*" );

selects everything with Sphere in the name.


You can also use MGlobal::select() to add an object to the global selection list without creating an MSelectionList first.