////////////
//
//  Script: senToggleResolutionGate 0.1.1
//  Updated: 7 May 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 run the script by executing
//  the senToggleResolutionGate 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 senToggleResolutionGate command.
//
//
//  Purpose:
//  By default you enable and disable Resolution Gates in the
//  Camera Settings of each viewport's View menu. This script
//  toogles the Resolution Gate of the active viewport and
//  sets the correct amount of overscan. Cuts down on the need
//  to use a menu.
//
////////////

global proc senToggleResolutionGate() {
	// Is a model panel focused? If it is, go on.
	string $focusedPanel = `getPanel -wf`;
	if (`getPanel -to $focusedPanel` == "modelPanel")
	{
		// Get camera name and Resolution Gate setting.
		string $camInPanel = `modelPanel -q -cam $focusedPanel`;
		int $camResGate = `camera -q -dr $camInPanel`;

		// Toggle Resolution Gate and set overscan.
		camera -e -dr (!$camResGate) $camInPanel;
		if (!$camResGate) camera -e -ovr 1.3 $camInPanel;
		else camera -e -ovr 1.0 $camInPanel;
	}
}

senToggleResolutionGate(All) MEL-Skript. Hinweis: Dieser Quellcode schaltet das Resolution Gate nur für die Kamera des aktiven Viewports um. Das ZIP-Archiv enthält zusätzlich eine Version, die die Resolution Gates aller Kameras umschaltet. So funktioniert das Skript: Zuerst prüft es, ob das Resolution Gate bei der Kamera des aktiven Viewports eingeschaltet ist. Anschließend schaltet es das Resolution Gate um und stellt den korrekten Overscan ein.

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