PDA

View Full Version : modelEditor + PyQt = problems


Zanozza
10-30-2012, 04:49 PM
Hi!
I've try to run modelEditor example from Autodesk help. Working well:
http://s018.radikal.ru/i518/1210/78/aeb1c1de2921t.jpg (http://radikal.ru/F/s018.radikal.ru/i518/1210/78/aeb1c1de2921.jpg)

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:

http://s57.radikal.ru/i157/1210/1b/9d0f6e9d3623t.jpg (http://radikal.ru/F/s57.radikal.ru/i157/1210/1b/9d0f6e9d3623.jpg)

Please help me to get this script working.

Thank you in advance!

CGTalk Moderation
10-30-2012, 04:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.