Background:
I am working in Maya 2018, 2019 and potentially Maya 2020 as well as Max 2019 and 2020. I need to build an interface in QTDesigner and use it for both Maya and Max.
Issues:
I’m starting with Maya and basically built a fully functioning maya version written in Python with Pyside2 but now that I have proven the functionality and pipeline, I am trying to move all of the UI out to QTDesigner, .ui, file. I get a window for a nano second but nothing shows up and it closes.
“”"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
import shiboken2
Maya specific libs
from PySide2.QtCore import *
from PySide2.QtUiTools import *
from PySide2.QtWidgets import *
import maya.OpenMayaUI as omui
def get_main_window():
main_window_ptr = omui.MQtUtil.mainWindow()
return shiboken2.wrapInstance(long(main_window_ptr), QWidget)
main_window = get_main_window()
class Main(QObject):
def init(self):
super(Main, self).init(main_window)
ui_file = QFile(“T:/utils/VAT/VATUI.ui”)
ui_file.open(QFile.ReadOnly)
loader = QUiLoader()
window = loader.load(ui_file)
ui_file.close()
btn = window.findChild(QPushButton, 'ExportAs')
btn.clicked.connect(self.closeEvent)
window.show()
def closeEvent(self, event):
"""
on close, this closes the ui
"""
super(Main, self).closeEvent(event)
self.window.close()
“”"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Am I missing something?
Is this a good way to create a tool for both programs that has to look and act the same?
Thanks,
Morris Olmsted
Sr. Technical Artist|Army Game Studio