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();
Sunday, August 22nd, 2010 Ranting

5 Comments to Maya 2011 dock your own MEL windows

  • Alan Eddie says:

    Hi there, just wondering – I can see how to dock most things but I want to create a window containing the Attribute editor and some custom panes on it and then dock that window. Do you think that is possible ?
    Using `lsUI` I can’t seem to find the attribute editor….
    Thanks
    Alan.

  • Rafeek Yanni says:

    Hello brekel i’m using kinect cam and brekel S/W , but i want to know how to use MEL Code in maya , i try it but i have problem “// Error: Cannot find procedure “dockControl”. //
    ” , i see this meaasge i don’t know what this so i want to know what the steps to use it .

    Thanks Mr.brekel , i waiting u replay as soon important

  • prasad says:

    hi brekel i like kinect mocap did saw captoface facial motioncapture can u devolope this kind of software.
    please i need that kind of software

  • Phyllis Imai says:

    I am lappful that I observed this site , the perfect info that we was trying to find!

  • Leave a Reply

    • Google+
    • LinkedIn
    • YouTube