Go to: Synopsis. Return value. MEL examples.

Synopsis

int addPanelCategory( string $name, string $insertAfter, string $cmd )

Add a new category to the Panels pulldown menus. The Panels pulldowns are the menus specified per viewport which allow the user to switch between different camera views, or different layouts, etc. The new category is defined by a new button which cascades into a separate user-definable pulldown menu. For example, you've defined your own camera type called "Stereo" and you want all your stereo cameras to appear under a separate category in the Panels pulldowns for convenience. What you can do from the plug-in where you define your cameras of this type when the plug-in first loads is to issue a MEL command of the form:
    addPanelCategory( "Stereo", "Perspective", "buildStereoPulldown" );
The preceeding call adds a new button called "Stereo" to the Panels pulldown menus, with the new button situated immediately after the existing "Perspective" buttom. The Stereo button displays a cascade icon and when selected, a user-implemented MEL procedure "buildStereoPulldown" is invoked to allow the user to define the entries for the cascading menu. An example for building a Perspective list might be:

global proc buildPerspectivePulldown( string $parent, string $panel )
{
string $cameras[] = `listCameras -perspective`;

// Rebuild menu
//
setParent -m $parent;
menu -e -deleteAllItems $parent;

for ($camera in $cameras) {
menuItem -l $camera -command
("lookThroughModelPanel "+$camera+" "+$panel);
}
}

For a type of camera other than perspective, the user may want to define some special means for identifying the camera type.

This apparatus is not specific to cameras. It is a general mechanism for adding a new cascading menu item to the Panels menu. For example, it could list custom model panels as well.

The user will most likely add the new category upon loading the new data from their plug-in code. To determine if a given category has already been added, the command listPanelCategories() is provided. To remove a category, the removePanelCategory() command is provided.

Return value

None

Arguments

Variable Name Variable Type Description
$namestringThe name of the category that appears on the new cascading button when added. The name specifies the label.
$insertAfterstringThe menu item to insert immediately after. This is the label value for the button, and examples are "Perspective", "Layouts", etc. Since the Panels menu may not have been built yet, the check that the $insertAfter button exists is not performed until the menu is posted.
$cmdstringA MEL command to be executed when the new category button is depressed. typically this will build an on-demand pulldown menu.

MEL examples

  addPanelCategory( "Stereo", "Perspective", "buildStereoPulldown" );