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): 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 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): # 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)