Since my project was mostly done, I took an initiative to learn new stuffs and enhance my maya workflow today. I still have bunch of things to do for the other hotbox. It's a potential area that could be heavily modified to suit ur workflow, thus, increase the efficiency and save un-necessary times :)
This one is just the beginning :D
/*
SCRIPT NAME: menu_Views.mel
VERSION: 1.0
AUTHOR: Original author: Tchoa [tchoa_2k@hotmail.com]
Script modified by Elte [veltigo@gmail.com]
MODIFIED: 18.09.06 - modification to simplify and suit my workflow.
ABOUT: Sedikit tambahan pada hotbox common Modeling Pane. Default hanya menampilkan persp, side, top, dan front. Script ini
menambahkan fungsi look through, tear off Panel dan Tampilan camera yg berada di scene.
USAGE: taroh script di \maya\x.x\prefs\markingMenus
Go to > Window | Settings/Preferences | Marking Menus... dan load the script, kemudian assign ke hotbox [region: center, mouse button : Left]
TIPS: Refresh views apabila camera di scene belum diload.
*/
global string $menu_Views;
$menu_Views = `setParent -q -m`;
// LIST CAMERAS
string $selection[] = `ls -sl`;
string $allCameras[] = `ls -ca`;
string $cameraShapes[];
string $cameras[];
clear $cameras;
int $i = 0;
for ($camera in $allCameras)
{
if ($camera != "frontShape" && $camera != "perspShape" && $camera != "sideShape" && $camera != "topShape")
{
$cameraShapes = `pickWalk -d up $camera`;
$cameras[$i++] = $cameraShapes[0];
}
}
int $n = -1;
for ($camera in $cameras)
{
menuItem
-label $camera
-command ("switchModelView Perspective;\r\nlookThru " + $camera + "; menu_Views_refresh;")
-enable 1
-enableCommandRepeat 1
-image "view.xpm"
-boldFont 0
("menuEditorMenuItemView" + ++$n);
$n++;
}
// REFRESH
menuItem
-label "Refresh Views"
-command "menu_Views_manage 0"
-enable 1
-radialPosition "NW"
-enableCommandRepeat 1
-boldFont 0
-italicized 1
menuEditorMenuItemViewsRefresh;
// LOOKTHRU
menuItem
-label "Look Through"
-command "menu_Views_manage 1"
-enable 1
-radialPosition "SW"
-enableCommandRepeat 1
-boldFont 0
-italicized 0
menuEditorMenuItemViewsRefreshLookThru;
// SELECT
menuItem
-label "Select View"
-command "menu_Views_manage 2"
-enable 1
-radialPosition "NE"
-enableCommandRepeat 1
-boldFont 0
-italicized 0
menuEditorMenuItemViewsSelect;
// TEAR OFF
menuItem
-label "Tear Off"
-command "menu_Views_manage 3"
-enable 1
-radialPosition "SE"
-enableCommandRepeat 1
-boldFont 0
-italicized 1
menuEditorMenuItemViewsTearOff;
//Persp View
menuItem
-label "Perspective View"
-divider 0
-subMenu 0
-command "switchModelView Perspective"
-altModifier 0
-optionModifier 0
-commandModifier 0
-ctrlModifier 0
-shiftModifier 0
-optionBox 0
-enable 1
-data 0
-radialPosition "N"
-enableCommandRepeat 1
-echoCommand 0
-italicized 0
-boldFont 0
menuItem261;
//Side View
menuItem
-label "Side View"
-divider 0
-subMenu 0
-command "switchModelView side"
-altModifier 0
-optionModifier 0
-commandModifier 0
-ctrlModifier 0
-shiftModifier 0
-optionBox 0
-enable 1
-data 0
-radialPosition "E"
-enableCommandRepeat 1
-echoCommand 0
-italicized 0
-boldFont 0
menuItem262;
//Front View
menuItem
-label "Front View"
-divider 0
-subMenu 0
-command "switchModelView front"
-altModifier 0
-optionModifier 0
-commandModifier 0
-ctrlModifier 0
-shiftModifier 0
-optionBox 0
-enable 1
-data 0
-radialPosition "S"
-enableCommandRepeat 1
-echoCommand 0
-italicized 0
-boldFont 0
menuItem263;
//Top View
menuItem
-label "Top View"
-divider 0
-subMenu 0
-command "switchModelView top"
-altModifier 0
-optionModifier 0
-commandModifier 0
-ctrlModifier 0
-shiftModifier 0
-optionBox 0
-enable 1
-data 0
-radialPosition "W"
-enableCommandRepeat 1
-echoCommand 0
-italicized 0
-boldFont 0
menuItem264;
// REFRESH MENU
global proc menu_Views_refresh()
{
/*global string $gMainWindow;
$menus = `window -q -ma $gMainWindow`;
string $label;
for ($menu in $menus)
{
$label = `menu -q -label $menu`;
if (`match "[Hh]ot[Bb]ox" $label` != "" && `match "[Cc]enter" $label` != "" && `match "2" $label` != "")
menu -e -dai $menu;
}*/
global string $menu_Views;
menu -e -dai $menu_Views;
}
// VIEWS MANAGER
global proc menu_Views_manage (int $mode)
{
string $command;
// 0:refresh 1:lookthru 2:tearoff 3:select 4:bookmarks 5:overscan 6:resolution 7:film 8:action 9:title
string $commands[] = {
"print \"Views refreshed!...\"",
"string $panel = `getPanel -wf`; string $objects[] = `ls -sl`; if (`size $objects`) lookThroughModelPanelClipped $objects[0] $panel .001 10000;",
"select -r $cam; pickWalk -d up; pickWalk -d down;",
"modelPanel -e -to $panel;\r\nfillEmptyPanes;",
};
if ($mode > 1)
{
$command = "string $panel = `getPanel -wf`; if (catch (`modelPanel -q -cam $panel`)) {warning \"No Camera in this Panel!...\";} ";
$command += "else {string $cam = `modelPanel -q -cam $panel`; " + $commands[$mode] + "}";
}
else
$command = $commands[$mode];
eval ($command);
menu_Views_refresh;
}