Skip to main content
maya

maya 2011 dockControl command

By April 28, 2010No Comments

Owen Burgess posts on MayaStation some information on the dockControl command in autodesk maya 2011. The dockControl command is a great new feature in Maya 2011.  Using a dockControl allows you to neatly fit your custom UI into the main Maya interface. This illustration shows the Script Editor docked where you would expect to find the Attribute Editor and Channel Box.

Let’s take a look at the example provided at the bottom of the Maya 2011 documentation page for dockControl (think to retrieve the name of your dockControl).

string $myWindow = `window`;
string $buttonForm = `formLayout -parent $myWindow`;
button -parent $buttonForm;
string $myDC = `dockControl -area “left”
-content $myWindow
-allowedArea “left”
-allowedArea “right” `;

This script creates a window and a dockControl; then assigns the window $myWindow to the dockControl. Once this is done, the window $myWindow can be docked in the Maya interface alongside any of the native Maya UI editors and control panels.

A few things to note here:

you can dispense with the showWindow command since the dockControl will display the contents of $myWindow for you.
the icons in the titlebar of the dockControl are different to the title bar of a regular window. The titlebar displays the dockControl window title, a button to float the control and a button to close the control.
if you close a window, it no longer exists, whereas if you close a dockControl it is merely removed from the interface: it is not deleted, and you can access it with a R-click of the mouse over the titlebar of any other docked UI (the shortcut for showing/hiding UI elements)
So let’s say you have a script that creates a new dockControl for every new window, like the script we just saw; when you delete the window, you will have to remember to remove the dockControl that is hosting it, otherwise if you just delete the window you will end up with a stack of empty dockControls in your Maya session. At this time you cannot swap the contents of an existing dockControl, so once it’s empty your dockControl is pretty useless. Think of deleting the dockControl, which will delete its contents as well:

deleteUI -control $myDC;

This command also deletes $myWin.

1) dock an existing window:

One cool thing you can do is dock existing panels or editors, such as the Script Editor.

With the Script Editor open, try this:

dockControl -area left -content scriptEditorPanel1Window
owensScriptEditorDC;

2) deleting your dockControl:

If you don’t know the name of your dockControl you can always use this script to identify a dockControl before deleting it.

for ($control in $controls) {
if (`dockControl -ex $control`)
print($control + ” is a dockControl\n”); }

lesterbanks

3D, VFX, design, and typography. Twenty year veteran instructor in all things computer graphics.