Search allows you to find menus, tools, or commands simply by typing them in a field. You can customize the results displayed when typing in certain search terms by adding your own runtime commands to the results or defining tags to filter the results.
To customize Search preferences
Maya displays the Search preferences window.
To customize tags
You can add new commands to Search, such as those for 3rd party plug-ins, by using runTimeCommands.
To get a command to appear in Search.
-label : The name of the action.
-annotation : A short description of what the command does. Search also searches this string.
-category : Where in the menu this action can be found eg. Menu items. Common. Edit) - this flag is NOT needed for non menu items.
-command : The command to be executed.
-plugin : The name of your plug-in if the command is related to one - this will enable us to load your plug-in (if required) before running the command (this will be an app wide option).
-image : Optional path to an icon.
-url : Optional custom url to external documentation.
-tags : Optional tags for your command. Eg. -tags "tag1;tag2".
-keywords : Optional keywords to help search results eg. -keywords "ocean; water".
runTimeCommand -label "Bevel Cube" -annotation "Create a bevelled cube" -command "polyCube; polyBevel" -keywords "chamfer" -tags "Polygon Creation;Polygon Editing;YourStudio" bevelCube;
menuItem -rtc "UnlockNormals";
This allows the menu item to look up the runTimeCommand UnlockNormals to get its label, annotation, image, and command.
To load your runtime commands alongside your plug-in, add a MAYA_RUNTIME_COMMANDS envar to your plug-in .mod file.
e.g. MAYA_RUNTIME_COMMANDS=$MAYA_RUNTIME_COMMANDS:/path/to/your/customCommands.mel
The new runtime command will be sourced when Maya starts up.
Do not use getPluginResource with runTimeCommands, or else your plug-in will not load when the runTimeCommands are registered.
Instead, use displayString, or uiRes to get internationalized strings.
// Register a string resource. Important: prefix your constants! m_myplugin.kFoo //not just kFoo. displayString -value "bar" m_myplugin.kFoo; // Print it using displayString print `displayString -query -v "m_myplugin.kFoo"`; // Print it using uiRes print uiRes("m_myplugin.kFoo"));
cmds.menuItem(p=renderingMenu, l='Submit to Foo', c='import foo_maya;foo_maya.submit_dialog()')
#Create runTimeCommand cmds.runTimeCommand('SubmitToFoo', d=True, label='Send to Foo', annotation='Send your scene to Foo for cloud rendering.', category='Menu items.Cloud.Render', command='import foo_maya;foo_maya.submit_dialog()', keywords='render', tags='Render' ) #Create menu cmds.menuItem(p=renderingMenu, rtc='SubmitToFoo')The "Submit to Foo" script will now show up in Search.