Hi! I try to write something on QT and here is the trouble.
My window is appear, work correctly, but viewport refuses to update by itself while the window is exists. When I select some mesh or something else it is not shown up highlighted until I tumble or zoom with my viewport camera. And the same happens if I try to change active tool by pressing Q,W,E or R-key.
Here is the code:
import sys
import PyQt4.Qt as qt
import maya.cmds as cmds
from hairSetup import *
import maya.mel as mel
from test4 import Ui_dialog
import pumpThread as pt
class MainForm(qt.QDialog, Ui_dialog):
def __init__(self):
super(MainForm, self).__init__()
self.setupUi( self )
self.connect(self.addHairButton, qt.SIGNAL("clicked()"), self.addHair)
self.connect(self.transferHairButton, qt.SIGNAL("clicked()"),self.transferHair)
self.connect(self.addGuideButton, qt.SIGNAL("clicked()"),self.addGuide)
self.connect(self.duplicateGuideButton, qt.SIGNAL("clicked()"),self.duplicateGuide)
self.connect(self.mirrorGuidesButton, qt.SIGNAL("clicked()"),self.mirrorGuides)
self.connect(self.addPartingButton, qt.SIGNAL("clicked()"),self.addPartingToMesh)
self.connect(self.removeGuidesButton, qt.SIGNAL("clicked()"),self.removeGuidesFromMesh)
self.connect(self.removeHairButton, qt.SIGNAL("clicked()"),self.removeHair)
self.connect(self.refreshButton, qt.SIGNAL("clicked()"),self.addGeotoList)
self.connect(self.clearButton, qt.SIGNAL("clicked()"),self.clear)
self.connect(self.listWidget, qt.SIGNAL("itemDoubleClicked(QListWidgetItem *)"), self.selectGeoItems)
self.addGeotoList()
def addHair(self):
addHairSystemToSeleced(0)
def transferHair(self):
copyHairSystemFromSelected(0)
def addGuide(self):
addGuideToSelected(0)
def duplicateGuide(self):
copySelectedGuide(0)
def mirrorGuides(self):
copyMirrorSelectedGuides(0)
def addPartingToMesh(self):
addParting(0)
def removeGuidesFromMesh(self):
removeGuides(0)
def removeHair(self):
deleteHairSystem(0)
def addGeotoList(self):
self.clear()
hairGeoList = cmds.ls(type='hairGeoShader')
for i in hairGeoList:
self.listWidget.addItem(i)
def clear(self):
self.listWidget.clear()
def selectGeoItems(self):
items = self.listWidget.selectedItems()
geoList = []
for i in items:
geoList.append(i.text())
cmds.select(geoList)
mel.eval('ShowAttributeEditorOrChannelBox;')
pt.initializePumpThread()
form = MainForm()
form.show()
app.exec_()
Could someone help me?