It is not working for me initially.
I think I am still screwing up somewhere... Is this correct for me to do it
in this way?
camLs = []
class orientCameraUI(QDialog):
def __init__(self, parent=None):
super(orientCameraUI, self).__init__(parent)
self.setMinimumWidth(300)
self.setMaximumHeight(80)
self.initUI()
self.camMenu()
self.createConnections()
def initUI(self):
...
def createConnections(self):
self.connect(self.setCameraBtn, SIGNAL('aboutToShow()'), self.
_updateMenu)
def camMenu(self):
allCams = [c for c in cmds.listRelatives(cmds.ls(cameras=1),parent=1
) if not cmds.camera(c, q=True, startupCamera=True)]
camLs.extend(allCams)
menu = QMenu("menu", self.setCameraBtn)
for item in camLs:
menu.addAction(QAction(item, menu))
self.setCameraBtn.setMenu(menu)
menu.aboutToShow.connect(self._updateMenu)
menu.triggered.connect(self._camSelected)
def _camSelected(self, action):
self.currentCamTxt.setText(action.text())
def _updateMenu(self):
menu = QMenu("menu", self.setCameraBtn)
menu.clear()
allCams = [c for c in cmds.listRelatives(cmds.ls(cameras=1),parent=1
) if not cmds.camera(c, q=True, startupCamera=True)]
if not allCams:
return
del camLs[:]
camLs.extend(allCams)
for item in camLs:
menu.addAction(item)
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/4fead427-96fa-4891-919b-26564df30b23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.