// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Creation Date: 29 January 2006 // // // // // // createModelEditorMenu( string $panel, string $editor, string $subset[], string $extra[], string $extraCmd[] ) // // // Creates the contents of the menuBar for a modelEditor. Since the // name of the modelEditor may not actually be known when you call this // procedure, you can specify the modelPanel name via $panel. The ability // to specify the contents of the menuBar is useful when building custom // modelPanels such as those associated with MPx3dModelView. // // // string $panel The name of the modelPanel. This is used // to get the modelEditor name if not known. // string $editor The name of the modelEditor. // string $subset[] The list of standard menuBar items that // you want to allow to be displayed. To just // let Maya display the standard set, pass an // empty array. Valid choices for the array // entries are: // "View" // "Shading" // "Lighting" // "Show" // "Renderer" // "Panels" // string $extra[] List of user-defined menu items you want // to be added to the menuBar. These appear // in the order specified, and come after the // left-side block of items. For each entry // in $extra, a menu button is created which // activates the command specified by the // corresponding entry in $extraCmd. The name // of the button is based on the value of the // entry in the $extra array. // string $extraCmd[] List of commands to be invoked when the // buttons specified via $extra are activated. // There is a one-to-one correspondence between // the entries in $extra and $extraCmd. The // commands themselves are standard MEL // commands. The commands themselves will be // invoked by Maya as follows: // // global proc myCmd( string $object, string $editor ) // The first parameter is the name of the menu // item, and the second the name of the parent // menu item. A typical command will construct // a pulldown menu and will function as follows: // 1) setParent -m $object; // 2) Check if the pulldown already exists and if so do nothing. // 3) Otherwise create the menu items in the pulldown. // // // //global proc dgtimerCmd( string $object, string $editor ) //{ // setParent -m $object; // if ( `menuItem -exists dgtimerStartItem` ) { // // Menu already built, so return. // return; // } // menuItem -label "Start" // -annotation "Turn on DG timing" // -command "dgtimer -on" dgtimerStartItem; // menuItem -label "Stop" // -annotation "Turn off DG timing" // -command "dgtimer -off" dgtimerStopItem; // menuItem -label "Reset" // -annotation "Reset the DG timers" // -command "dgtimer -reset" dgtimerResetItem; // menuItem -label "Query" // -annotation "Query the current DG timer values" // -command "dgtimer -q" dgtimerQueryItem; //} // // // Create the window with a menuBar // // // string $window = `window -menuBar on`; // string $form = `formLayout`; // string $editor = `exampleMultiCameraView`; // User-supplied command: see MPx3dModelEditorCommand // // string $subset[] = {"Shading"}; // Only display the "Shading" pulldown on the menuBar // string $extra[] = {"DG timer"}; // Display an extra button called "DG timer" // string $extraCmd[] = {"dgtimerCmd"}; // When the "DG timer" button is clicked, run this command // // // Now, create the menuBar contents. // // We have the name of the modelEditor, so we pass that as $editor. // // // createModelEditorMenu( "", $editor, $subset, $extra, $extraCmd ); // // // // global proc createModelEditorMenu( string $panel, string $editor, string $subset[], string $extra[], string $extraCmd[] ) { createModelPanelMenuDoIt( $panel, $editor, $subset, $extra, $extraCmd ); }