Go to: Synopsis. Return value. MEL examples.
int addPanelCategory( string $name, string $insertAfter, string $cmd )
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.
None
Variable Name | Variable Type | Description |
---|---|---|
$name | string | The name of the category that appears on the new cascading button when added. The name specifies the label. |
$insertAfter | string | The 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. |
$cmd | string | A MEL command to be executed when the new category button is depressed. typically this will build an on-demand pulldown menu. |
addPanelCategory( "Stereo", "Perspective", "buildStereoPulldown" );