I came across an interesting use case in Maya where I wanted to temporarily store information about selections of vertices. So that when I click away to move a control of a rig/etc. I can quickly get back to what I was doing with the vertices without thinking too much of which vertices they were. So, I decided to write a handy UI script in Python for Maya to do this exact thing. I suspect it will come in handy down the road, as it supports all sorts of selection types.

Screenshot

Each Selection history can be saved with a nickname to help you remember. Nicknames can be non-unique, as the data of what is actually selected is listed next to it. 

Each Selection history can be saved with a nickname to help you remember. Nicknames can be non-unique, as the data of what is actually selected is listed next to it. 

Download

Latest Script found on my Github Repo:
http://github.com/Animatic33/MayaPython/blob/master/agMayaQuickSelect/

You can also download this script (along with others) in ZIP format here:
https://github.com/Animatic33/MayaPython/archive/master.zip

Install and Use

After adding the py file to your scripts folder, you can initialize it Maya's script editor with this piece of code:

globalSelectionDictionary = {}
import agMayaQuickSelect as qsh
reload(qsh) # just in case
qsh.selectHistoryUI(globalSelectionDictionary)

Use the following code when generating a shelf button:

try:
    type(globalSelectionDictionary)
except:
    globalSelectionDictionary = {}
import agMayaQuickSelect as qsh
qsh.selectHistoryUI(globalSelectionDictionary)

Info on why this code is a little different: this code checks for whether the globalSelectionDictionary exists already, if not, it will generate a new one. We don't want to overwrite the dictionary every time the shelf button is pressed, so we run this check in case.

Tips

  • After typing a nickname you can simply hit Enter on the number pad to add an entry.
  • Hit "Del" on a list item to delete it from the list
  • Double click a list item to select it with the selection settings set below it.
  • Cycle through selection is just an iterator going through the list of selected items. It will use the selection settings below.
  • Difference and Common selection tools are comparative functions. This is in case you want to use the comparative functionality for removing or intersecting components selected.

Usually I would write about what's going on in the script, but for now, I'll just leave the repo link for your downloading pleasure and a couple screenshots for your perusal.