////////////
//
//  Script: senToggleWireframeOnShaded 0.1
//  Updated: 12 March 2008
//  Compatibility: Maya 8 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!
//
//
//  Usage:
//  Focus a viewport (for example middle mouse-click
//  anywhere in a viewport) and execute the
//  senToggleWireframeOnShaded 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 senToggleWireframeOnShaded command.
//
//
//  Purpose:
//  By default you set Wireframe on Shaded mode in the Shading
//  menu of each viewport. This script not only toggles
//  Wireframe on Shaded for all viewports at once, it also
//  cuts down the need to use a menu.
//
////////////

global proc senToggleWireframeOnShaded() {
	// Is a model panel focused? If it is, go on.
	string $focusedPanel = `getPanel -wf`;
	if (`getPanel -to $focusedPanel` == "modelPanel")
	{
		// Check WoS setting and get a list of all model panels.
		int $focusedPanelWOS = `modelEditor -q -wos $focusedPanel`;
		string $modelPanels[] = `getPanel -typ modelPanel`;
		{
			// Toggle WoS for all model panels.
			for ($element in $modelPanels)
			{
				modelEditor -e -wos (!$focusedPanelWOS) $element;
			}
		}
	}
}

senToggleWireframeOnShaded MEL-Skript. Dieses Skript schaltet Wireframe on Shaded für alle Viewports um. Zuerst prüft es, ob das ausgewählte Panel vom Typ modelPanel ist – ein normaler Viewport. Wenn es das ist, fragt das Skript den Status von Wireframe on Shaded im modelPanel ab. Es speichert außerdem eine Liste aller modelPanels der Szene. Zum Schluss setzt das Skript den Wireframe-on-Shaded-Modus in allen modelPanels auf das Gegenteil von dem, was es im ausgewählten Panel ist.

Dieses Skript herunterladen (941 Byte)
Maya 8 oder höher, funktioniert vermutlich auch mit früheren Versionen.