rjCMDSearch package

Module contents

Read all buttons in Maya’s native menu and make them searchable and executable.

https://github.com/robertjoosten/rjCMDSearch/raw/master/README.gif

Link to Video

Installation

Copy the rjCMDSearch folder to your Maya scripts directory

C:/Users/<USER>/Documents/maya/scripts

Usage

Add the interface and functionality to Maya:

import maya.cmds as cmds
cmds.evalDeferred("import rjCMDSearch; rjCMDSearch.install()")

Note

Every time the UI is opened for the first time in a new session of Maya, the script loops over all of Mayas MenuBar content to retrieve all of the its information and store it in an easy accessible format. Since its over 1600 buttons, this process will take a few seconds. Its best to add this script to the userSetup.py so the interface will automatically be added to Maya when it is started.

The commands can always be refreshed by clicking on the magnifying glass button.

The script now also tries to install a hotkey on the Ctrl + Alt + Space combination. If there is already a hotkey on this combination the hotkey will not be installed. This hotkey will set the focus to the search command and open up the menu if there are any matches.

It is also possible to store your pins and create different pins sets for different tasks, meaning you can create your own custom menu. This functionality can be accessed by clicking the magnifying glass button.

Also a thank you too Perry Leijten and Guillaume Dufief for their ideas and pointers to improve the script.

Command Line

The following functions can be used outside of the ui. Make sure the language is set to python.

import rjCMDSearch; rjCMDSearch.focus()  

Code

rjCMDSearch.focus(*args, **kwargs)

Set focus to the input search field of the cmd search widget. Will return early if either the results window or the search bar already has focus.

Parameters:cmdSearch (CMDSearch) – decorator handles this argument
rjCMDSearch.getCMDSearch(func)

This decorator will only run the function if the cmd search can be found, if this is not the case an error will be raised. The timeline marker will be parsed as the first argument into the function provided.

Raises:ValueError – if cmd search cannot be found in globals
rjCMDSearch.install()

Add the cmd search functionality to Maya’s native status bar. If rjCMDSearch is already installed it will remove the previous instance.

rjCMDSearch.registerHotkey()

Register hotkey to set focus to the search field, the hotkey combination registered is Ctrl + Alt + Space. If a hotkey is already registered to that combination a failed message will be printed.