def getMayaMainWindow():
"""
Since Maya is Qt, we can parent our UIs to it.
This means that we don't have to manage our UI and can leave it to Maya.
Returns:
QtWidgets.QMainWindow: The Maya MainWindow
"""
# We use the OpenMayaUI API to get a reference to Maya's MainWindow
win = omui.MQtUtil_mainWindow()
# Then we can use the wrapInstance method to convert it to something python can understand
# In this case, we're converting it to a QMainWindow
ptr = wrapInstance(long(win), QtWidgets.QMainWindow)
# Finally we return this to whoever wants it
return ptr
评论列表
文章目录