def __init__(self, dock=True): if dock: parent = getDock() else: deleteDock() try: cmds.deleteUI('LightingManager') except: logger.debug('No previous UI exists') parent = QtWidgets.QDialog(parent=getMayaMainWindow()) parent.setObjectName('LightingManager') parent.setWindowTitle('Lighting Manager') dlgLayout = QtWidgets.QVBoxLayout(parent) super(toolBoxIII, self).__init__(parent=parent) self.setWindowTitle('Lighting Manager') self.buildUI() self.populate() self.parent().layout().addWidget(self) if not dock: parent.show() self.userAppDir = cmds.internalVar(userAppDir=True) self.userLibaryDir = self.userAppDir + 'userLibrary' if not os.path.exists(self.userLibaryDir): os.mkdir(self.userLibaryDir)
def __init__(self, dock=True): if dock: parent = getDock() else: deleteDock() try: cmds.deleteUI('Pipeline Tool') except: logger.debug('No previous UI exists') parent = QtWidgets.QDialog(parent=getMayaMainWindow()) parent.setObjectName('Pipeline Tool') parent.setWindowTitle('Pipeline Tool') dialogLayout = QtWidgets.QVBoxLayout(parent) super ( MayaMainUI, self ).__init__( parent=parent ) self.curMode = self.getMode() logger.info('get mode: %s' % self.curMode.upper()) self.buildUI() if not dock: parent.show()
def getRenderManLight(self): if len(self.renderManLights) > 0: self.iconBtnLayout.addWidget(QtWidgets.QLabel("|")) self.iconBtnLayout.addWidget(QtWidgets.QLabel("RenderMan: ")) for lightType in self.renderManLights: icon = QIcon(typeMgr.getIcon(lightType)) cmd = partial(self.createNewLight, lightType) toolTip = 'Create a new ' + lightType # renderManLightAction = self.createAction( lightType, icon, cmd, toolTip ) # mayaLightTB.addAction( renderManLightAction ) button = self.iconButton(cmd, icon, toolTip) self.iconBtnLayout.addWidget(button) else: pass
def buildUI(self): layout = QtWidgets.QGridLayout(self) layout.setContentsMargins(5,5,5,5) # Create a label to note for Maya light mayaLightLabel = QtWidgets.QLabel('Maya Lights') mayaLightLabel.setAlignment(QtCore.Qt.AlignCenter) layout.addWidget(mayaLightLabel, 0,0,1,6) # Create a label to note for Vray light vrayLightLabel = QtWidgets.QLabel('Vray Lights') vrayLightLabel.setAlignment(QtCore.Qt.AlignCenter) layout.addWidget(vrayLightLabel, 0,6,1,8) # Create a combo box that has the list of Maya light type self.mayaLightTypeCB = QtWidgets.QComboBox() # Put lightType into combo Box (Maya lights) for lightType in sorted(self.mayaLightTypes): self.mayaLightTypeCB.addItem(lightType) layout.addWidget(self.mayaLightTypeCB, 1,0,1,4) # Create a button to create the light base on the selection of the combo box createMayaLightBtn = QtWidgets.QPushButton('Create') createMayaLightBtn.clicked.connect(partial(self.createLight, 'Maya Light')) layout.addWidget(createMayaLightBtn, 1,4,1,2) # Create a combo box that has the list of Vray light type self.vrayLightTypeCB = QtWidgets.QComboBox() # Put lightType into combo Box (Maya lights) for lightType in sorted(self.vrayLightTypes): self.vrayLightTypeCB.addItem(lightType) layout.addWidget(self.vrayLightTypeCB, 1,6,1,6) # Create a button to create the light base on the selection of the combo box createVrayLightBtn = QtWidgets.QPushButton('Create') createVrayLightBtn.clicked.connect(partial(self.createLight, 'Vray Light')) layout.addWidget(createVrayLightBtn, 1,12,1,2) # Create Scroll layout to add the light created from buttons above into main layout via LightWidget class scrollWidget = QtWidgets.QWidget() scrollWidget.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) self.scrollLayout = QtWidgets.QVBoxLayout(scrollWidget) scrollArea = QtWidgets.QScrollArea() scrollArea.setWidgetResizable(True) scrollArea.setWidget(scrollWidget) layout.addWidget(scrollArea, 2,0,1,14)
def getArnoldLight(self): if len(self.arnoldLights) > 0: self.iconBtnLayout.addWidget(QtWidgets.QLabel("|")) self.iconBtnLayout.addWidget(QtWidgets.QLabel("Arnold: ")) for lightType in self.arnoldLights: icon = QIcon(typeMgr.getIcon(lightType)) cmd = partial(self.createNewLight, lightType) toolTip = 'Create a new ' + lightType # arnoldLightAction = self.createAction( lightType, icon, cmd, toolTip ) # mayaLightTB.addAction( arnoldLightAction ) button = self.iconButton(cmd, icon, toolTip) self.iconBtnLayout.addWidget(button) # self.iconBtnLayout.addStretch(1) else: pass
def getVrayLight(self): self.vrayLightTB = QtWidgets.QToolBar('Vray Light') if len(self.vrayLights) > 0: self.iconBtnLayout.addWidget(QtWidgets.QLabel("|")) self.iconBtnLayout.addWidget(QtWidgets.QLabel("Vray: ")) for lightType in self.vrayLights: icon = QIcon(typeMgr.getIcon(lightType)) cmd = partial(self.createNewLight, lightType) toolTip = 'Create a new ' + lightType # vrayLightAction = self.createAction( lightType, icon, cmd, toolTip ) # self.vrayLightTB.addAction( vrayLightAction ) button = self.iconButton(cmd, icon, toolTip) self.iconBtnLayout.addWidget(button) else: pass
def populateLibrarySection(self): self.listLibWidget.clear() self.library.find() for name, info in self.library.items(): item = QtWidgets.QListWidgetItem(name) self.listLibWidget.addItem(item) screenshot = info.get('screenshot') if screenshot: icon = QtGui.QIcon(screenshot) item.setIcon(icon)
def __init__(self, dock=True): if dock: parent = getDock(name='Channel Box', label='Channel Box') else: deleteDock() try: cmds.deleteUI('Channel Box') except: logger.debug('No previous UI exists') parent = QtWidgets.QDialog(parent=getMayaMainWindow()) parent.setObjectName('Channel Box') parent.setWindowTItle('Channel Box') dialogLayout = QtWidgets.QVBoxLayout(parent) super(ChannelBox, self).__init__(parent=parent) self.buildUI() if not dock: parent.show()
def buildUI(self): layout = QtWidgets.QGridLayout(self) self.name = QtWidgets.QCheckBox() self.name.setChecked(self.light.visibility.get()) self.name.toggled.connect( lambda val: self.light.getTransform().visibility.set(val)) def setLightVisibility(val): self.light.visibility.set(val) layout.addWidget(self.name, 0, 0) self.setName = QtWidgets.QLabel(str(self.light.getTransform())) self.setName.setMinimumWidth(120) layout.addWidget(self.setName, 0, 1) soloBtn = QtWidgets.QPushButton('Solo') soloBtn.setCheckable(True) soloBtn.toggled.connect(lambda val: self.onSolo.emit(val)) soloBtn.setMinimumWidth(80) layout.addWidget(soloBtn, 0, 2) deleteBtn = QtWidgets.QPushButton('Delete') deleteBtn.clicked.connect(self.deleteLight) deleteBtn.setMinimumWidth(80) layout.addWidget(deleteBtn, 0, 3) intensity = QtWidgets.QSlider(QtCore.Qt.Horizontal) intensity.setMinimum(0) intensity.setMaximum(1000) intensity.setMinimumWidth(160) intensity.setValue(self.light.intensity.get()) intensity.valueChanged.connect( lambda val: self.light.intensity.set(val)) layout.addWidget(intensity, 0, 4, 1, 1) self.colorBtn = QtWidgets.QPushButton() self.colorBtn.setMinimumWidth(80) self.colorBtn.clicked.connect(self.setColor) layout.addWidget(self.colorBtn, 0, 5)
def buildUI(self): self.layout = QtWidgets.QGridLayout(self) pluginLights = typeMgr.pluginLights() self.mayaLights = sorted(typeMgr.mayaLights()) self.vrayLights = sorted( [f for f in pluginLights if f.startswith("VRay")]) self.renderManLights = sorted( [f for f in pluginLights if f.startswith("Pxr")]) self.arnoldLights = sorted( [f for f in pluginLights if f.startswith("ai")]) iconBtnWidget = QtWidgets.QWidget() self.iconBtnLayout = QtWidgets.QHBoxLayout(iconBtnWidget) self.layout.addWidget(iconBtnWidget, 0, 0) self.iconBtnLayout.addWidget(QtWidgets.QLabel("Maya_tk: ")) # self.mayaLightTB = QtWidgets.QToolBar('Maya_tk Light') self.getMayaLight() self.getVrayLight() self.getRenderManLight() #self.getArnoldLight() self.lightLibraryUI() scrollWidget = QtWidgets.QWidget() scrollWidget.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) self.scrollLayout = QtWidgets.QVBoxLayout(scrollWidget) scrollArea = QtWidgets.QScrollArea() scrollArea.setWidgetResizable(True) scrollArea.setWidget(scrollWidget) self.layout.addWidget(scrollArea, 1, 0, 1, 5)
def buildUI(self): # Create a layout layout = QtWidgets.QGridLayout(self) layout.setContentsMargins(2,2,2,2) # Create a check box of light for visibility self.name = QtWidgets.QCheckBox(str(self.light.getTransform())) self.name.setChecked(self.light.visibility.get()) self.name.toggled.connect(lambda val: self.light.getTransform().visibility.set(val)) layout.addWidget(self.name, 0,0) # Create a solo button, it will turn on only the light selected, and disable all others soloBtn = QtWidgets.QPushButton('Solo') soloBtn.setMaximumWidth(40) soloBtn.setCheckable(True) soloBtn.toggled.connect(lambda val: self.onSolo.emit(val)) layout.addWidget(soloBtn, 0,1) # Create delete button, delete the light selected deleteBtn = QtWidgets.QPushButton('Delete') deleteBtn.setMaximumWidth(40) deleteBtn.clicked.connect(self.deleteLight) layout.addWidget(deleteBtn, 0, 2) # intensity of light intensityLight = QtWidgets.QLineEdit(str(self.light.intensity.get())) intensityLight.setMaximumWidth(80) intensityLight.textChanged.connect(lambda val: self.light.intensity.set(float(val))) layout.addWidget(intensityLight, 0,3) # Change mode of light self.colorBtn = QtWidgets.QPushButton() self.colorBtn.setMaximumSize(20,20) self.setButtonColor() self.colorBtn.clicked.connect(self.setColorLight) layout.addWidget(self.colorBtn, 0,4)
def createAction(self, lightType, icon, cmd, toolTip): action = QtWidgets.QAction(icon, lightType, self) action.setStatusTip(toolTip) action.triggered.connect(partial(cmd)) return action
def lightLibraryUI(self): libraryLabel = QtWidgets.QLabel('') libraryLabel.setAlignment(QtCore.Qt.AlignCenter) self.layout.addWidget(libraryLabel, 0, 0, 1, 4) libHeaderWidget = QtWidgets.QWidget() libHeaderLayout = QtWidgets.QHBoxLayout(libHeaderWidget) libHeaderScrollArea = QtWidgets.QScrollArea() libHeaderScrollArea.setWidget(libHeaderWidget) libHeaderScrollArea.setWidgetResizable(True) libHeaderScrollArea.setMaximumHeight(45) self.layout.addWidget(libHeaderScrollArea, 2, 0, 1, 5) self.saveNameField = QtWidgets.QLineEdit() self.saveNameField.setMinimumWidth(60) libHeaderLayout.addWidget(self.saveNameField) saveBtn = QtWidgets.QPushButton('Save') saveBtn.setMinimumWidth(120) saveBtn.clicked.connect(self.saveItem) libHeaderLayout.addWidget(saveBtn) buf = 12 self.listLibWidget = QtWidgets.QListWidget() self.listLibWidget.setViewMode(QtWidgets.QListWidget.IconMode) self.listLibWidget.setIconSize(QtCore.QSize(60, 60)) self.listLibWidget.setResizeMode(QtWidgets.QListWidget.Adjust) self.listLibWidget.setGridSize(QtCore.QSize(60 + buf, 60 + buf)) self.layout.addWidget(self.listLibWidget, 3, 0, 1, 5) libFooterWidget = QtWidgets.QWidget() # libFooterWidget.setSizePolicy( QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum ) self.libFooterLayout = QtWidgets.QGridLayout(libFooterWidget) self.libFooterLayout.setContentsMargins(QtCore.QMargins(2, 2, 2, 2)) # Create QScrollArea scrollLibArea = QtWidgets.QScrollArea() scrollLibArea.setWidget(libFooterWidget) scrollLibArea.setWidgetResizable(True) scrollLibArea.setMaximumHeight(45) self.layout.addWidget(scrollLibArea, 4, 0, 1, 5) # Create QPlushButton importLibBtn = QtWidgets.QPushButton('Import') importLibBtn.setMinimumWidth(120) importLibBtn.clicked.connect(self.loadItem) self.libFooterLayout.addWidget(importLibBtn, 0, 0) # # Create QPlushButton referenceBtn = QtWidgets.QPushButton('Reference') referenceBtn.setMinimumWidth(120) referenceBtn.clicked.connect(self.referenceItem) self.libFooterLayout.addWidget(referenceBtn, 0, 1) # # Create QPlushButton removeBtn = QtWidgets.QPushButton('Remove') removeBtn.setMinimumWidth(120) removeBtn.clicked.connect(self.removeItem) self.libFooterLayout.addWidget(removeBtn, 0, 2)
def buildUI(self): # ann1 = ['Open/Load scene','Take a snapshot','Publish file'] # ic1 = ['openLoad.icon.png','snapshot.icon.png','publish.icon.png'] # cm1 = [self.bts.loaderUI,self.bts.snapshotUI,self.bts.publishUI] # self.bts.setIconButton( ann1, cm1, ic1 ) anns = ['Hypershader', 'Plugin Manager', 'Outliner','Script Editor', 'Graph Editor', 'UV Editor', 'Spread Sheet', 'Channel Box', 'Node Editor', 'Vray VFB', 'Render Setting', ] commands = ['cmds.HypershadeWindow()', 'cmds.PluginManager()', 'mel.eval("OutlinerWindow;")', self.bts.openScriptEditor, 'mel.eval("GraphEditor;")', 'mel.eval("TextureViewWindow;")', self.bts.spreadSheetUI, self.bts.channelBoxUI, 'cmds.NodeEditorWindow()', self.bts.openVrayVFB, 'cmds.RenderGlobalsWindow()',] icons = ['hypershader.icon.png', 'pluinManager.icon.png', 'outliner.icon.png', 'scriptEditor.icon.png', 'graphEditor.icon.png', 'uvEditor.icon.png', 'spreadsheet.icon.png', 'channelBox.icon.png', 'nodeEditor.icon.png', 'vrayVFB.icon.png', 'renderSetting.icon.png', ] w = WIDTH w1 = ICONWIDTH w2 = w-w1 #row colummn width for Main UI nc2 = 2 cw2 = [(1,w1),(2,w2)] self.layout = QtWidgets.QGridLayout(self) cmds.scrollLayout('masterLayout', w=w+16) mlo = cmds.rowColumnLayout(nc=nc2, cw=cw2) cmds.columnLayout() self.bts.iconButton(ann='reloadUI', icon=geticon('Logo.icon.png'), command=self.bts.refreshMainUI) self.bts.makeSeparator( h=5, w=ICONWIDTH ) self.bts.setIconButton(anns, commands, icons) self.bts.makeSeparator(h=5, w=ICONWIDTH) cmds.setParent(mlo) # Menu menuBar = cmds.menuBarLayout() self.menuSection(menuBar) # UI right side sections mlor = cmds.columnLayout(w=w2) self.tabControls = cmds.tabLayout('mlorTabControls') t1 = cmds.columnLayout(w=w2) nc=4 wl1 = [100, 140, 140, 25] wl2 = [100, 280, 25] cmds.rowColumnLayout(nc=nc, cw=self.bts.cwCustomize(nc, wl1)) cmds.text( l="Prod Name: ", align='center' ) cmds.textField( 'Prod Name', tx=self.prodName ) self.setCurModeMenu = cmds.optionMenu('setCurModeMenu', cc=self.bts.waitforupdate, ) cmds.menuItem(l="Studio Mode", p=self.setCurModeMenu) cmds.menuItem(l="Group Mode", p=self.setCurModeMenu) self.refreshCheckMode() self.bts.refreshBtn(self.refreshCheckMode) cmds.setParent('..') nc=3 cmds.rowColumnLayout( nc=nc, cw=self.bts.cwCustomize(nc,wl2)) cmds.text( l="Production Path", align='center' ) cmds.textField( 'prodPthTf', tx=self.prodPth ) self.bts.refreshBtn(self.refreshProdPth) cmds.text( l="Project Path", align='center' ) cmds.textField( 'projPthTf', tx=self.curPth ) self.bts.refreshBtn(self.refreshProjPth) cmds.setParent('..') nc=4 adj = 10 cmds.rowColumnLayout( nc=4, cw=self.bts.cwE(nc, w2, adj)) # anns, commands, labels, anns = ['Set Project directory', 'Open Project manager UI', 'Create A new production', 'Refresh info'] commands = [self.setProject, self.bts.projManagerUI, self.bts.newProd, self.refreshInfo] labels = ['Set Project', 'Project Manager', 'New Production', 'Refresh Info'] self.bts.setCoolButton(anns=anns, commands=commands, labels=labels) cmds.setParent(t1) self.projectContentUI() cmds.setParent( t1 ) cmds.setParent( mlor ) cmds.separator( style='in', w=w2 ) mlor_lo1 = cmds.columnLayout( w=w2 ) self.commonSectionUI() cmds.setParent( mlor_lo1 ) t2 = cmds.columnLayout( parent=self.tabControls, w=w2 ) self.modelingTab() cmds.setParent( self.tabControls ) t3 = cmds.columnLayout(parent=self.tabControls ) self.bts.makeAcoolButton("Demo buttons", 'Rigging', self.bts.waitforupdate ) cmds.setParent( self.tabControls ) t4 = cmds.columnLayout( parent=self.tabControls ) self.surfacingTab() cmds.setParent( self.tabControls ) t5 = cmds.columnLayout(parent=self.tabControls ) self.bts.makeAcoolButton("Demo buttons", 'Dynamics', self.bts.waitforupdate ) cmds.setParent( self.tabControls ) t6 = cmds.columnLayout(parent=self.tabControls ) self.bts.makeAcoolButton("Demo buttons", 'Animation', self.bts.waitforupdate ) cmds.setParent( self.tabControls ) t7 = cmds.columnLayout(parent=self.tabControls ) self.bts.makeAcoolButton("Demo buttons", 'Light Manager', self.bts.lightManager ) cmds.setParent( self.tabControls ) # Create appropriate labels for the ts cmds.tabLayout( self.tabControls, edit=True, tabLabel=( (t1, "Project"), (t2, "Model"), (t3, "Rig"), (t4, "Surface"), (t5, "FX"), (t6, "Anim"), (t7, "Light")) )
def buildUI(self): self.layout = QtWidgets.QGridLayout(self) self.cb1 = cmds.channelBox('Channel Box') self.menuChannelBoxWhenRightClick()