示例#1
0
 def getMayaLight(self):
     for lightType in self.mayaLights:
         icon = QIcon(typeMgr.getIcon(lightType))
         cmd = partial(self.createNewLight, lightType)
         toolTip = 'Create a new ' + lightType
         # mayaLightAction = self.createAction( lightType, icon, cmd, toolTip)
         # self.mayaLightTB.addAction(mayaLightAction)
         button = self.iconButton(cmd, icon, toolTip)
         self.iconBtnLayout.addWidget(button)
示例#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
示例#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
示例#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
示例#5
0
    def __init__(self, parent=None):
        super(EditorCentralWidget, self).__init__(parent=parent)
        self.disposed = False
        self.lookThroughWindow = None

        # Set up the model that the tree view will use
        typeMgr.rebuild()
        self.model = ItemModel()

        self.resize(self.STARTING_SIZE)

        layout = QVBoxLayout()

        # Create tab layout
        self.tabWidget = QWidget()
        tabLayout = QHBoxLayout()
        QLayoutItem.setAlignment(tabLayout, Qt.AlignBottom)
        tabLayout.setContentsMargins(0, 0, self.TAB_LAYOUT_RIGHT_MARGIN,
                                     self.TAB_LAYOUT_BOTTOM_MARGIN)
        tabLayout.setSizeConstraint(QLayout.SetMinimumSize)

        self.tabButtons = []
        self.lightButtons = []

        mayaLights = typeMgr.mayaLights()
        for lightType in mayaLights:
            if typeMgr.excludeFromUI(lightType):
                continue
            icon = QIcon(typeMgr.getIcon(lightType))
            button = RenderSetupButton(self, icon, self.BUTTON_SIZE)
            button.clicked.connect(self.getLightCreator(lightType))
            toolTip = maya.stringTable['y_editor.kCreateaNew1'] + lightType
            button.setToolTip(toolTip)
            self.tabButtons.append(button)
            self.lightButtons.append(button)
            tabLayout.addWidget(button)

        pluginLights = typeMgr.pluginLights()
        if len(pluginLights) > 0:
            tabLayout.addWidget(QLabel(" | "))

            for lightType in pluginLights:
                icon = QIcon(typeMgr.getIcon(lightType))
                button = RenderSetupButton(self, icon, self.BUTTON_SIZE)
                button.clicked.connect(self.getLightCreator(lightType))
                toolTip = maya.stringTable['y_editor.kCreateaNew2'] + lightType
                button.setToolTip(toolTip)
                self.tabButtons.append(button)
                # Don't add plugin lights to the lightButton array
                # This is only used for automated testing and a plugin light might
                # have custom dialogs pop up that the test system can't handle
                # self.lightButtons.append(button)
                tabLayout.addWidget(button)

        tabLayout.addWidget(QLabel(" | "))

        button = QPushButton(maya.stringTable['y_editor.kNewGroup2'])
        button.clicked.connect(self.newGroup)
        button.setToolTip(maya.stringTable['y_editor.kCreateaNewGroup'])
        self.tabButtons.append(button)
        self.groupButton = button
        tabLayout.addWidget(button)

        tabLayout.addWidget(QLabel(" | "))

        self.layerText = QLabel(LAYER_TEXT)
        tabLayout.addWidget(self.layerText)

        tabLayout.addStretch(1)

        icon = QIcon(":/view.png")
        button = RenderSetupButton(self, icon, self.BUTTON_SIZE)
        button.clicked.connect(self._lookThroughSelected)
        self.tabButtons.append(button)
        tabLayout.addWidget(button)

        icon = QIcon(":/snapToGeo.png")
        button = RenderSetupButton(self, icon, self.BUTTON_SIZE)
        button.clicked.connect(self._snapToSelected)
        self.tabButtons.append(button)
        tabLayout.addWidget(button)

        self.tabWidget.setLayout(tabLayout)
        layout.addWidget(self.tabWidget)

        # Adds tree view to the window's layouts
        self.treeView = EditorTreeView(self)
        self.treeView.header().resizeSections(QHeaderView.ResizeToContents)
        # The name column needs to be set to a larger size
        self.treeView.setColumnWidth(0, NAME_COLUMN_WIDTH)
        layout.addWidget(self.treeView)

        self.setLayout(layout)

        self.mayaPreFileNewOrOpenedID = om.MEventMessage.addEventCallback(
            "PreFileNewOrOpened", self._onMayaPreFileNewOrOpenedCB, self)
        self.mayaSelectionChangedID = om.MEventMessage.addEventCallback(
            "SelectionChanged", self._onMayaSelectionChangedCB, self)
        self.mayaNewSceneOpenedID = om.MEventMessage.addEventCallback(
            "NewSceneOpened", self._onMayaSceneChangedCB, self)
        self.mayaSceneOpenedID = om.MEventMessage.addEventCallback(
            "SceneOpened", self._onMayaSceneChangedCB, self)
        self.mayaSceneImportedID = om.MEventMessage.addEventCallback(
            "SceneImported", self._onMayaSceneChangedCB, self)
        self.mayaNodeAddedID = om.MDGMessage.addNodeAddedCallback(
            self._onMayaNodeAddedCB, "dependNode", self)

        # We need to track changes to Color Management since we
        # handle color management for light source colors ourself
        self.mayaColorMgtIDs = []
        self.mayaColorMgtIDs.append(
            om.MEventMessage.addEventCallback("colorMgtEnabledChanged",
                                              self._onMayaColorMgtChangedCB,
                                              self))
        self.mayaColorMgtIDs.append(
            om.MEventMessage.addEventCallback("colorMgtConfigChanged",
                                              self._onMayaColorMgtChangedCB,
                                              self))
        self.mayaColorMgtIDs.append(
            om.MEventMessage.addEventCallback("colorMgtWorkingSpaceChanged",
                                              self._onMayaColorMgtChangedCB,
                                              self))
        self.mayaColorMgtIDs.append(
            om.MEventMessage.addEventCallback(
                "colorMgtPrefsViewTransformChanged",
                self._onMayaColorMgtChangedCB, self))
        self.mayaColorMgtIDs.append(
            om.MEventMessage.addEventCallback("colorMgtPrefsReloaded",
                                              self._onMayaColorMgtChangedCB,
                                              self))
        self.mayaColorMgtIDs.append(
            om.MEventMessage.addEventCallback("colorMgtUserPrefsChanged",
                                              self._onMayaColorMgtChangedCB,
                                              self))

        self.model.loadScene()
        self.treeView.loadColumnOrder()
        self._onMayaSelectionChangedCB(None)

        # Restore all expanded nodes, beginning from the root
        self._restoreExpandedState(self.treeView.rootIndex())