Exemplo n.º 1
0
    def createCustomLayer(self):
        if cmds.selectedNodes() is None:
            QtWidgets.QMessageBox.information(
                self, "Alert", "Please select assets in the Outliner!")
        else:
            layerType = str(self.comboLayerType.currentText())
            layerName = str(self.leLayerName.text()).upper()
            parentList = list(
                set(
                    map(lambda node: str(node).strip("|").split("|")[0],
                        cmds.selectedNodes())))

            if layerType == "ENVIR":
                if "CHAR" in parentList:
                    QtWidgets.QMessageBox.information(
                        self, "Alert",
                        "CHAR type asset selected to create ENVIR layer!")
                else:
                    self.RLManager.createCustomEnvirLayer(
                        layerName, self.cutOutCheckBox.isChecked())
            else:
                if "ENVIR" in parentList:
                    QtWidgets.QMessageBox.information(
                        self, "Alert",
                        "ENVIR type asset selected to create ENVIR layer!")
                else:
                    self.RLManager.createCustomCharLayer(
                        layerName, self.cutOutCheckBox.isChecked())
Exemplo n.º 2
0
 def createCustomCharCollection(self, isCutoutChecked):
     """create collection custom char collection"""
     c_customChar = self.layer.createCollection("c_customCharAllChar")
     c_customChar.getSelector().setFilterType(0)
     c_customChar.getSelector().setPattern((",").join(cmds.selectedNodes()))
     o_customCharVisibility = c_customChar.createOverride(
         "customCharVisibility", override.AbsOverride.kTypeId)
     attribute = self.getListUptoFirstMeshNode(cmds.selectedNodes()[0])
     if isCutoutChecked == True:
         o_customCharVisibility.finalize(attribute + ".aiMatte")
         o_customCharVisibility.setAttrValue(0)
     else:
         o_customCharVisibility.finalize(attribute + ".primaryVisibility")
         o_customCharVisibility.setAttrValue(1)
Exemplo n.º 3
0
    def export_shaders_to_presets_dir(self, presets_path):
        shaders = cmds.selectedNodes()
        if not shaders:
            cmds.inViewMessage(amg='Please select Shaders for Export', pos='midCenter', fade=True, fadeOutTime=500)
            return

        for shader in shaders:
            shader_type = cmds.nodeType(shader)
            if shader_type not in self.accepted_shaders:
                cmds.inViewMessage(amg='Please select from the following shader types: %s ' % self.accepted_shaders,
                                   pos='midCenter', fade=True, fadeOutTime=500)
                return

        directory = str(QtGui.QFileDialog.getExistingDirectory(dir=presets_path,
                                                               caption="Choose Shader Preset Directory"))
        if directory:
            directory = directory.replace('\\', '/')

            for shader in shaders:
                data = self.get_shader_data(shader)
                output_path = directory + "/" + data['shader name'] + ".pre"

                with open(output_path, 'w') as outfile:
                    json.dump(data, outfile, sort_keys=True, indent=4, separators=(',', ': '))

        cmds.inViewMessage(amg='Export finished', pos='midCenter', fade=True, fadeOutTime=500)
Exemplo n.º 4
0
def objectPosition(*args):
    try:
        selectedNodes = cmds.selectedNodes()
        mainObj = selectedNodes[-1]
        positionList = cmds.getAttr('%s.translate' % mainObj)
        return positionList[0]
    except:
        return (0.0, 0.0, 0.0)
def deleteOthers(ns):
	util.debug("Delete not in namespace: %s" % ns)
	cmds.select(ado=1)
	cmds.select(
		cmds.ls("%s:*" % ns), 
		d=1
	)
	cmds.delete(cmds.selectedNodes(dagObjects=1))
Exemplo n.º 6
0
 def labelName(self, label='position'):
     sel = cmds.ls(sl=True)
     string = ''
     if len(sel) == 0:
         string = label + '  ---'
     else:
         string = label + '  ' + str(cmds.selectedNodes()[0].rsplit('|')[1])
     return string
Exemplo n.º 7
0
    def createCustomLayer(self):
        if cmds.selectedNodes() is None:
            QtGui.QMessageBox.information(self, "Alert", "Please select assets in the Outliner!")    
        else:
            layerType = str(self.comboLayerType.currentText())
            layerName = str(self.leLayerName.text()).upper()
            
            if layerType == "ENVIR":
				self.renderLayerController.createCustomEnvirLayer(layerType+"_"+layerName, self.cutOutCheckBox.isChecked())
            elif layerType == "CHAR":
				self.renderLayerController.createCustomCharLayer(layerType+"_"+layerName, self.cutOutCheckBox.isChecked())
Exemplo n.º 8
0
    def getShotNumber(self, *args):
        shotNumber = cmds.intFieldGrp(self.shotNumber, query=True, value1=True)
        selectedNodes = cmds.selectedNodes() or []
        if not len(selectedNodes) == 0:
            mainObj = selectedNodes[-1]
            positionList = cmds.getAttr('%s.translate' % mainObj)
        else:
            positionList = [0.0, 0.0, 0.0]

        positionList[0] = shotNumber

        return positionList
Exemplo n.º 9
0
def exportLightRig():

    if cmds.selectedNodes():
        sceneName = getSceneFileName()
        sceneName = sceneName[:sceneName.find(".")]
        filePath = os.path.join(getSequenceLightingDir(), sceneName + "_rig")
        cmds.file(filePath, f=True, exportSelected=True, type="mayaAscii")
        cmds.confirmDialog(title='Information',
                           message="Rig exported to " + filePath,
                           button=['OK'],
                           defaultButton='OK')
    else:
        cmds.confirmDialog(title='Alert',
                           message="LIGHTS not selected in the Outliner!",
                           button=['OK'],
                           defaultButton='OK')
Exemplo n.º 10
0
    def export_shaders_to_presets_dir(self, presets_path):
        shaders = cmds.selectedNodes()
        if not shaders:
            cmds.inViewMessage(amg='Please select Shaders for Export',
                               pos='midCenter',
                               fade=True,
                               fadeOutTime=500)
            return

        for shader in shaders:
            shader_type = cmds.nodeType(shader)
            if shader_type not in self.accepted_shaders:
                cmds.inViewMessage(
                    amg='Please select from the following shader types: %s ' %
                    self.accepted_shaders,
                    pos='midCenter',
                    fade=True,
                    fadeOutTime=500)
                return

        directory = str(
            QtGui.QFileDialog.getExistingDirectory(
                dir=presets_path, caption="Choose Shader Preset Directory"))
        if directory:
            directory = directory.replace('\\', '/')

            for shader in shaders:
                data = self.get_shader_data(shader)
                output_path = directory + "/" + data['shader name'] + ".pre"

                with open(output_path, 'w') as outfile:
                    json.dump(data,
                              outfile,
                              sort_keys=True,
                              indent=4,
                              separators=(',', ': '))

        cmds.inViewMessage(amg='Export finished',
                           pos='midCenter',
                           fade=True,
                           fadeOutTime=500)
Exemplo n.º 11
0
def deleteOthers(node):
	util.debug("Deleting objects everything but '%s'" % node)
	cmds.select(ado=1)
	cmds.select(node, d=1)
	cmds.delete(cmds.selectedNodes(dagObjects=1))
Exemplo n.º 12
0
 def shotStage(self, *args):
     stageCheck = cmds.textFieldGrp(self.stageCheck, query=True, tx=True)
     sSelectedNodes = cmds.selectedNodes()
     print stageCheck