MEL
Maya 2011 dock your own MEL windows
As you might have noticed with the new Qt-based GUI for Maya 2011 it is now possible to dock most of the windows.
You can for example tear off the Channel Box and snap it to the left of the main GUI instead of the right, or leave it as a floating window.
Great stuff, and what’s even better is that you can also do it for your own custom windows.
Here’s a quick example showing how to do that.
By default I set it up so it docks on the right, where usually the Channel Box, Attribute Editor and Tool Settings reside.
But the code should be pretty self explanatory if you want to change that.
global proc brekel_dockedWindowExample()
{
// settings
int $floating = 0; // 0=docked 1=floating
string $defaultDockArea = "right"; // "top", "left", "bottom", "right";
int $blankLine = 12;
string $blankLineStyle = "in";
//define our GUI window
string $title = "Brekel Docked Window Example";
string $win = "brekelDockedWindowExample";
string $dock = $win +"dock";
//check if the window exists and delete it if it does
if (`window -exists $win`)
deleteUI $win;
if( `dockControl -exists $dock` )
deleteUI $dock;
//define the GUI window
window -width 512 -height 256 -sizeable true -title $title $win;
// form layout
string $form = `formLayout -parent $win`;
// main layout
columnLayout -adjustableColumn true;
// start contents
separator -height $blankLine -style $blankLineStyle;
button -label "Button Top";
separator -height $blankLine -style $blankLineStyle;
rowLayout -numberOfColumns 3;
button -label "Button Left";
button -label "Button Middle";
button -label "Button Right";
setParent..;
setParent..;
// end contents
// show & dock window
showWindow $win;
dockControl
-area $defaultDockArea
-floating $floating
-content $win
-allowedArea "left"
-allowedArea "right"
-label $title
$dock;
}
brekel_dockedWindowExample();