Maya: Modifying the Native Interface

One of the great things about Maya is the access you have to customize the native interface. This is especially helpful when you are trying to seamlessly integrate your studio environment and toolsets within Maya.

Maya offers a utility that allows you to grab a native UI element and convert it to a PySide object. You can then use the Qt API to manipulate it as you please.

MEL GLOBAL VARIABLES

In order to retrieve a UI element as a Qt object, we need to get it’s path within Maya’s interface. One way to access it via MEL’s stored globals by running the following code. This returns a list of the Maya globals. You can sift through the list to get value you are looking for.

CUSTOMIZING THE STATUS LINE

Modifying the status line in Maya gives you quick access to any custom tools or you can decide to slap on a widget, such as a QLabel that displays information useful to the user.  In the example below I added a custom button that, when clicked, triggers the creation of a poly sphere in my scene. You can tie the button to launch a tool or some other operation. You can also set an icon on the button instead of displaying a text. Since the button is a QPushButton widget, you can modify it as you please through the Qt API. 

maya_pyside2_customize_status_line.png
Previous
Previous

Qt and Designer

Next
Next

PYCHARM 2019 & MAYA