Skip to content

Instantly share code, notes, and snippets.

@cerina
cerina / maya_mel_globals.py
Created December 21, 2020 05:35
Maya: Get MEL Globals
import maya.mel as mel
mel_globals = mel.eval("env")
for mel_global in mel_globals:
print mel_global
@cerina
cerina / maya_pyside2_modify_status_line.py
Last active July 5, 2025 09:08
Maya: PySide2 - Modify Maya's Native Status Line
import shiboken2
from PySide2 import QtWidgets
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMayaUI as omui
# Get the MEL global value for the status line element. The status line is what holds the
# buttons at the top of Maya that has the mode dropdown (modeling, animation, rigging, etc),
# selection type toggle buttons, render buttons, etc...
name = mel.eval('string $tempStr = $gStatusLine')
@cerina
cerina / maya_pyside2_dockable_ui.py
Last active July 5, 2025 09:08
Maya: PySide2 - Dockable UI using MayaQWidgetDockableMixin
from shiboken2 import wrapInstance
from PySide2 import QtCore, QtWidgets
import maya.cmds as cmds
from maya import OpenMayaUI
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
def get_maya_win():
win_ptr = OpenMayaUI.MQtUtil.mainWindow()
return wrapInstance(long(win_ptr), QtWidgets.QMainWindow)