Beispiel #1
0
    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)
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
    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)
Beispiel #6
0
    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)
Beispiel #7
0
    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: "))

        # 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)
Beispiel #8
0
 def createAction(self, lightType, icon, cmd, toolTip):
     action = QtWidgets.QAction(icon, lightType, self)
     action.setStatusTip(toolTip)
     action.triggered.connect(partial(cmd))
     return action
Beispiel #9
0
    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)