Hi!
I’ve try to run modelEditor example from Autodesk help. Working well:
Then I’ve create PyQt custom UI:
from PyQt4 import QtCore, QtGui
import maya.cmds as maya
import maya.mel as mel
import maya.OpenMayaUI as mui
import sip
def getMayaWindow():
'Get the maya main window as a QMainWindow instance'
ptr = mui.MQtUtil.mainWindow()
return sip.wrapinstance(long(ptr), QtCore.QObject)
def getControl(controlName):
ptr = mui.MQtUtil.findControl(controlName)
return sip.wrapinstance(long(ptr), QtCore.QObject)
class MyDialog(QtGui.QDialog):
def __init__(self, parent=getMayaWindow()):
super(MyDialog, self).__init__(parent)
self.setObjectName("MyWindow")
self.resize(800, 600)
self.setWindowTitle("PyQt Model Editor Test")
self._cameraName= maya.camera(centerOfInterest=2.450351,
position = (1.535314, 1.135712, 1.535314),
rotation = (-27.612504, 45, 0),
worldUp = (-0.1290301, 0.3488592, -0.1290301))[0]
maya.cone()
modeleditor=maya.modelEditor()
maya.modelEditor( modeleditor, edit=True, camera=self._cameraName )
self.qtEditor=getControl(modeleditor)
self.verticalLayout = QtGui.QVBoxLayout(self)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.addWidget(self.qtEditor)
mel.eval('modelEditor -e -da "smoothShaded" '+ str(modeleditor))
def show():
global myWindow
myWindow = MyDialog()
myWindow.show()
myWindow.qtEditor.repaint()
Running by:
import MS_SplashView; win = MS_SplashView.show()
And here I have a strange behaviour, seems that I’ve try to “inject” wrapped modelEditor by wrong way:
Please help me to get this script working.
Thank you in advance!