//  Script: senToggleIsolateSelect 0.1
//  Updated: 19 May 2006
//  Compatibility: Maya 7 and higher
//  Probably works with earlier versions, too.
//  Written by Sven-Erik Neve
//  Website and contact info: www.seneve.de
//  Bugs, comments, questions or suggestions? Get in touch!
//  Inspired by Jorge Pimentel's Isolate Select ShelfButton 1.1:
//  http://www.highend3d.com/users/56797.html
//  Also inspired by Eric Pavey
//  http://mayamel.tiddlyspot.com/
//  Usage:
//  Select what you'd like to isolate and focus a viewport
//  (for example middle mouse-click anywhere in a viewport).
//  Run the script by executing the senToggleIsolateSelect
//  command.
//  Installation:
//  Copy this source code within a MEL file to one of your
//  scripts folders, for example on Windows XP 32-bit to the
//  folder \My Documents\maya\<version>\scripts. Start Maya
//  or (if it is running) use the rehash command to make Maya
//  aware of the newly copied script. Execute the script with
//  the senToggleIsolateSelect command.
//  Purpose:
//  Isolate mode helps you concetrate on one part of a scene.
//  It's an alternative to hiding and unhiding objects.
//  By default you toggle Isolate mode separately for each
//  viewport in the viewports' Show menu. This script eases
//  isolating and unisolating. Firstly, it cuts down on the
//  need to use a menu. Secondly, it toggles Isolate mode
//  for all viewports at once, not just for one. Lastly, the
//  script allows newly created objects to be visible even
//  when Isolate mode is active.

global proc senToggleIsolateSelect() {
	// Is a model panel focused? If it is, go on.
	string $focusedPanel = `getPanel -wf`;
	if (`getPanel -to $focusedPanel` == "modelPanel")
		// Check Isolate setting, get list of model panels.
		int $isoValue = `isolateSelect -q -s $focusedPanel`;
		string $modelPanels[] = `getPanel -typ modelPanel`;
			// Toogle Isolate mode for all model panels.
			for ($element in $modelPanels)
				isolateSelect -s (!$isoValue) $element;
				if ($isoValue) isolateSelect -rs $element;
				else isolateSelect -as $element;
			// Allow newly created objects to be visible.
			isoSelectAutoAddNewObjs $focusedPanel (!$isoValue);

senToggleIsolateSelect MEL script. This script toggles Isolate mode on and off for the current selection. At first it determines the current panel's Isolate mode and saves a list of all panels of type modelPanel in the scene. It then toggles Isolate mode. Finally the script allows new objects to be automatically visible.

Special thanks go to Jorge Pimentel and Eric Pavey whose work inspired the script, namely Jorge's Isolate Select ShelfButton and Eric's MEL Wiki.

Download this script (1.2 KiByte)
Maya 7 or higher, probably works with earlier versions, too.