Exemplo n.º 1
0
	def entityListAction(self) : 
		# find associate path
		selStatus = self.getSelStatus()
		selTask = self.getSelTask()
		selEntity = self.getSelEntity()
		selProject = str(self.ui.project_comboBox.currentText())
		entityType = str(self.ui.entity_comboBox.currentText())		
		step = str(self.ui.step_comboBox.currentText())
		serverStep = setting.stepSgPipeMap[step]

		entityName = selEntity[0]
		entitySub1 = selEntity[1]
		entitySub2 = selEntity[2]

		self.asset = entityInfo.info2(entityType, selProject, entityName, entitySub1, entitySub2)
		workDir = self.asset.workDir(serverStep, selTask)
		self.asset2 = entityInfo.info(workDir)

		# set UI
		self.ui.path_lineEdit.setText(workDir)
		self.setPathUI(workDir)

		# list work area
		self.listWorkFileUI()

		# list note 
		self.showNoteAction()
Exemplo n.º 2
0
def saveStill(mediaType='still', ext=False):
    asset = entityInfo.info()
    # save to surface
    mediaDir = asset.surfaceOutput(mediaType)
    currentFile = asset.fileName(ext=False)

    files = fileUtils.listFile(mediaDir)
    fileName = '%s_%02d' % (currentFile, 1)

    if files:
        fileCount = 0

        for each in files:
            if currentFile in each:
                fileCount += 1

        fileName = '%s_%02d' % (currentFile, fileCount + 1)

    # save to surface
    result = saveVrayRender(mediaDir, fileName, img='jpg')
    print 'Saved to %s' % result

    if result:
        src = '%s.jpg' % result

        if os.path.exists(src):
            # save to hero
            heroDir = asset.mediaHeroName(mediaType=mediaType, returnPath=True)
            dst = '%s.jpg' % heroDir
            result2 = fileUtils.copy(src, dst)

            print 'Saved to %s' % result2

        return src
Exemplo n.º 3
0
    def doConnectShade(self):
        title = 'connect shade'
        asset = entityInfo.info()
        edlPath = asset.dataPath(asset.uv,
                                 '%s_%s' % (asset.uv, asset.taskLOD()),
                                 data='edl')
        shadePath = asset.dataPath(asset.uv,
                                   '%s_%s' % (asset.uv, asset.taskLOD()),
                                   data='shadeFile')
        shadeFile = str()
        edlFile = str()

        edlFiles = sorted(fileUtils.listFile(edlPath))

        if edlFiles:
            edlFile = '%s/%s' % (edlPath, edlFiles[-1])

        shadeFiles = sorted(fileUtils.listFile(shadePath))

        if shadeFiles:
            shadeFile = '%s/%s' % (shadePath, shadeFiles[-1])

        if edlFile and shadeFile:
            namespace = 'Rig'
            result = pipelineTools.assignShader(shadeFile, edlFile, namespace)

            self.setStatus(title, True)

        else:
            self.messageBox('Error', 'No edl file')
Exemplo n.º 4
0
    def doConnectShade(self) : 
        title = 'connect shade'
        asset = entityInfo.info()
        edlPath = asset.dataPath(asset.uv, '%s_%s' % (asset.uv, asset.taskLOD()), data = 'edl')
        shadePath = asset.dataPath(asset.uv, '%s_%s' % (asset.uv, asset.taskLOD()), data = 'shadeFile')
        shadeFile = str()
        edlFile = str()

        edlFiles = sorted(fileUtils.listFile(edlPath))

        if edlFiles : 
            edlFile = '%s/%s' % (edlPath, edlFiles[-1])

        shadeFiles = sorted(fileUtils.listFile(shadePath))

        if shadeFiles : 
            shadeFile = '%s/%s' % (shadePath, shadeFiles[-1])

        if edlFile and shadeFile : 
            namespace = 'Rig'
            result = pipelineTools.assignShader(shadeFile, edlFile, namespace)

            self.setStatus(title, True)

        else : 
            self.messageBox('Error', 'No edl file')
Exemplo n.º 5
0
    def doSyncHData(self) : 
        title = 'sync HData'
        asset = entityInfo.info()
        hDir = asset.rigDataPath('hdata')
        files = fileUtils.listFile(hDir)
        node = 'Geo_Grp'

        if files : 
            latestFile = files[-1]
            path = '%s/%s' % (hDir, latestFile)
            print 'Hdata file %s' % path

            pipelineTools.applyHierarchyData(node, path)
            result = pipelineTools.removeExcessiveGeo(node, path)
            print 'Done'

            if result : 
                self.messageBox('Warning', 'Excessive geometries')
                print result
                self.setStatus('%s - Excessive geometries' % title, True)

            else : 
                self.messageBox('Success', 'Sync hierarchy complete')
                self.setStatus('%s' % title, True)

        else : 
            self.messageBox('Error', 'No H-Data. Contact Rig department')
            self.setStatus('%s - No H-Data' % title, False)
Exemplo n.º 6
0
    def doSyncInfo(self) : 
        asset = entityInfo.info()
        rigGrps = ['Rig_Grp', 'Rig:Rig_Grp']
        assetID = self.getAssetID()
        attrs = ['assetID', 'assetType', 'assetSubType', 'assetName', 'project']
        values = [assetID, asset.type(), asset.subType(), asset.name(), asset.project()]
        geoGrps = ['Geo_Grp', 'Rig:Geo_Grp']
        refPath = asset.getPath('ref')

        pipelineTools.assignGeoInfo()

        for rigGrp in rigGrps : 
            if mc.objExists(rigGrp) : 

                i = 0 
                for each in attrs : 
                    attr = '%s.%s' % (rigGrp, each)

                    if mc.objExists(attr) : 
                        if not each == 'assetID' : 
                            mc.setAttr(attr, values[i], type = 'string')

                        else : 
                            mc.setAttr(attr, values[i])

                    i += 1 

        for geoGrp in geoGrps : 
            if mc.objExists(geoGrp) : 
                mc.setAttr('%s.%s' % (geoGrp, 'id'), assetID)
                mc.setAttr('%s.%s' % (geoGrp, 'ref'), refPath, type = 'string')

        self.setStatus('Sync info', True)
        self.messageBox('Information', 'Sync Complete')
Exemplo n.º 7
0
    def doRefDevRig(self):
        title = 'Ref Dev Rig'
        asset = entityInfo.info()
        # dev rig
        devFile = asset.getRefNaming('devRig')
        devPath = asset.getPath('dev')
        devRigPath = '%s/%s' % (devPath, devFile)

        allRefs = mc.file(q=True, r=True)

        if os.path.exists(devRigPath):
            if not devRigPath in allRefs:
                mc.file(devRigPath,
                        r=True,
                        ignoreVersion=True,
                        gl=True,
                        loadReferenceDepth="all",
                        namespace="Rig",
                        options="v=0")
                self.setStatus(title, True)

            else:
                self.setStatus('%s - File exists' % title, True)

        else:
            self.messageBox('Warning', 'File not exists %s' % devRigPath)
            self.setStatus('%s - File not exists' % title, False)
Exemplo n.º 8
0
    def doSyncHData(self):
        title = 'sync HData'
        asset = entityInfo.info()
        hDir = asset.rigDataPath('hdata')
        files = fileUtils.listFile(hDir)
        node = 'Geo_Grp'

        if files:
            latestFile = files[-1]
            path = '%s/%s' % (hDir, latestFile)
            print 'Hdata file %s' % path

            pipelineTools.applyHierarchyData(node, path)
            result = pipelineTools.removeExcessiveGeo(node, path)
            print 'Done'

            if result:
                self.messageBox('Warning', 'Excessive geometries')
                print result
                self.setStatus('%s - Excessive geometries' % title, True)

            else:
                self.messageBox('Success', 'Sync hierarchy complete')
                self.setStatus('%s' % title, True)

        else:
            self.messageBox('Error', 'No H-Data. Contact Rig department')
            self.setStatus('%s - No H-Data' % title, False)
Exemplo n.º 9
0
    def doExportVrayNodes(self):
        title = 'Export Vray Nodes'
        asset = entityInfo.info()

        returnResult = dict()
        exportPath = asset.getPath('refData')
        nodeFile = '%s/%s' % (exportPath, asset.getRefNaming('vrayNode'))
        dataFile = '%s/%s' % (exportPath, asset.getRefNaming('vrayNodeData'))

        startMTime1 = None
        startMTime2 = None
        currentMTime1 = None
        currentMTime2 = None

        if os.path.exists(nodeFile):
            startMTime1 = os.path.getmtime(nodeFile)

        if os.path.exists(dataFile):
            startMTime2 = os.path.getmtime(dataFile)

        result = pipelineTools.exportVrayNode(dataFile, nodeFile)

        dataFileResult = result[0]
        nodeFileResult = result[1]

        if dataFileResult:
            currentMTime1 = os.path.getmtime(dataFileResult)

        if nodeFileResult:
            currentMTime2 = os.path.getmtime(nodeFileResult)

        status = False
        status1 = False
        status2 = False
        message = ''

        if not currentMTime1 == startMTime1:
            status1 = True
            message += 'Node file export complete - '

        if not currentMTime2 == startMTime2:
            status2 = True
            message += 'Node data file export complete'

        if status1 and status2:
            status = True

        if status:
            self.setStatus(title, True)

        trace('---- Vray Nodes Output ---')
        trace(dataFileResult)
        trace(nodeFileResult)
Exemplo n.º 10
0
    def getAssetID(self) : 
        from tool.utils.sg import sg_utils as sgUtils
        asset = entityInfo.info()
        filters = [['project.Project.name', 'is', asset.project()], 
                    ['sg_asset_type', 'is', asset.type()], 
                    ['sg_subtype', 'is', asset.subType()], 
                    ['code', 'is', asset.name()]]
        fields = ['id']
        result = sgUtils.sg.find_one('Asset', filters, fields)

        if result : 
            return result['id']
Exemplo n.º 11
0
    def doExportVrayNodes(self) : 
        title = 'Export Vray Nodes'
        asset = entityInfo.info()

        returnResult = dict()
        exportPath = asset.getPath('refData')
        nodeFile = '%s/%s' % (exportPath, asset.getRefNaming('vrayNode'))
        dataFile = '%s/%s' % (exportPath, asset.getRefNaming('vrayNodeData'))

        startMTime1 = None
        startMTime2 = None
        currentMTime1 = None
        currentMTime2 = None

        if os.path.exists(nodeFile) : 
            startMTime1 = os.path.getmtime(nodeFile)

        if os.path.exists(dataFile) : 
            startMTime2 = os.path.getmtime(dataFile)

        result = pipelineTools.exportVrayNode(dataFile, nodeFile)

        dataFileResult = result[0]
        nodeFileResult = result[1]

        if dataFileResult : 
            currentMTime1 = os.path.getmtime(dataFileResult)

        if nodeFileResult : 
            currentMTime2 = os.path.getmtime(nodeFileResult)

        status = False
        status1 = False 
        status2 = False
        message = ''

        if not currentMTime1 == startMTime1 : 
            status1 = True 
            message += 'Node file export complete - '

        if not currentMTime2 == startMTime2 : 
            status2 = True
            message += 'Node data file export complete'

        if status1 and status2 : 
            status = True

        if status : 
            self.setStatus(title, True)

        trace('---- Vray Nodes Output ---')
        trace(dataFileResult)
        trace(nodeFileResult)
Exemplo n.º 12
0
    def getAssetID(self):
        from tool.utils.sg import sg_utils as sgUtils
        asset = entityInfo.info()
        filters = [['project.Project.name', 'is',
                    asset.project()], ['sg_asset_type', 'is',
                                       asset.type()],
                   ['sg_subtype', 'is', asset.subType()],
                   ['code', 'is', asset.name()]]
        fields = ['id']
        result = sgUtils.sg.find_one('Asset', filters, fields)

        if result:
            return result['id']
Exemplo n.º 13
0
def assign() : 
    asset = entityInfo.info()
    dataPath = '%s/data' % asset.getPath('uv', 'uv_%s' % asset.taskLOD())
    edlUVPath = '%s/%s' % (dataPath, 'edl')
    shadeFilePath = '%s/%s' % (dataPath, 'shadeFile')

    dataFiles = sorted(fileUtils.listFile(edlUVPath))
    shadeFiles = sorted(fileUtils.listFile(shadeFilePath))
    namespace = 'Rig'

    if shadeFiles and dataFiles : 
        shadeFile = '%s/%s' % (shadeFilePath, shadeFiles[-1])
        edlFile = '%s/%s' % (edlUVPath, dataFiles[-1])

        if os.path.exists(shadeFile) and os.path.exists(edlFile) : 
            assignShader(shadeFile, edlFile, namespace)
Exemplo n.º 14
0
def assign():
    asset = entityInfo.info()
    dataPath = '%s/data' % asset.getPath('uv', 'uv_%s' % asset.taskLOD())
    edlUVPath = '%s/%s' % (dataPath, 'edl')
    shadeFilePath = '%s/%s' % (dataPath, 'shadeFile')

    dataFiles = sorted(fileUtils.listFile(edlUVPath))
    shadeFiles = sorted(fileUtils.listFile(shadeFilePath))
    namespace = 'Rig'

    if shadeFiles and dataFiles:
        shadeFile = '%s/%s' % (shadeFilePath, shadeFiles[-1])
        edlFile = '%s/%s' % (edlUVPath, dataFiles[-1])

        if os.path.exists(shadeFile) and os.path.exists(edlFile):
            assignShader(shadeFile, edlFile, namespace)
Exemplo n.º 15
0
    def doTestABC(self) : 
        title = 'Test ABC'
        asset = entityInfo.info()
        abcDir = asset.rigDataPath('abc')
        files = fileUtils.listFile(abcDir)
        obj = 'Geo_Grp'

        if files : 
            latestFile = files[-1]
            path = '%s/%s' % (abcDir, latestFile)
            print 'abc file %s' % path 

            abcUtils.importABC(obj, path, mode = 'add')
            self.messageBox('Success', 'Apply cache complete')
            self.setStatus(title, True)

        else : 
            self.messageBox('Error', 'No abc cache file. Contact Rig department')
            self.setStatus(title, False)
Exemplo n.º 16
0
    def doSyncInfo(self):
        asset = entityInfo.info()
        rigGrps = ['Rig_Grp', 'Rig:Rig_Grp']
        assetID = self.getAssetID()
        attrs = [
            'assetID', 'assetType', 'assetSubType', 'assetName', 'project'
        ]
        values = [
            assetID,
            asset.type(),
            asset.subType(),
            asset.name(),
            asset.project()
        ]
        geoGrps = ['Geo_Grp', 'Rig:Geo_Grp']
        refPath = asset.getPath('ref')

        pipelineTools.assignGeoInfo()

        for rigGrp in rigGrps:
            if mc.objExists(rigGrp):

                i = 0
                for each in attrs:
                    attr = '%s.%s' % (rigGrp, each)

                    if mc.objExists(attr):
                        if not each == 'assetID':
                            mc.setAttr(attr, values[i], type='string')

                        else:
                            mc.setAttr(attr, values[i])

                    i += 1

        for geoGrp in geoGrps:
            if mc.objExists(geoGrp):
                mc.setAttr('%s.%s' % (geoGrp, 'id'), assetID)
                mc.setAttr('%s.%s' % (geoGrp, 'ref'), refPath, type='string')

        self.setStatus('Sync info', True)
        self.messageBox('Information', 'Sync Complete')
Exemplo n.º 17
0
    def doTestABC(self):
        title = 'Test ABC'
        asset = entityInfo.info()
        abcDir = asset.rigDataPath('abc')
        files = fileUtils.listFile(abcDir)
        obj = 'Geo_Grp'

        if files:
            latestFile = files[-1]
            path = '%s/%s' % (abcDir, latestFile)
            print 'abc file %s' % path

            abcUtils.importABC(obj, path, mode='add')
            self.messageBox('Success', 'Apply cache complete')
            self.setStatus(title, True)

        else:
            self.messageBox('Error',
                            'No abc cache file. Contact Rig department')
            self.setStatus(title, False)
Exemplo n.º 18
0
    def doRefDevRig(self) : 
        title = 'Ref Dev Rig'
        asset = entityInfo.info()
        # dev rig
        devFile = asset.getRefNaming('devRig')
        devPath = asset.getPath('dev')
        devRigPath = '%s/%s' % (devPath, devFile)

        allRefs = mc.file(q = True, r = True)

        if os.path.exists(devRigPath) : 
            if not devRigPath in allRefs : 
                mc.file(devRigPath, r = True, ignoreVersion = True, gl = True, loadReferenceDepth = "all", namespace = "Rig", options = "v=0")
                self.setStatus(title, True)

            else : 
                self.setStatus('%s - File exists' % title, True)

        else : 
            self.messageBox('Warning', 'File not exists %s' % devRigPath)
            self.setStatus('%s - File not exists' % title, False)
Exemplo n.º 19
0
	def menuCommand(self, command, categories) : 
		fileName = str(self.ui.work_listWidget.currentItem().text())
		path = str(self.ui.path_lineEdit.text())
		filePath = self.publishFileMap[fileName]
		asset = entityInfo.info(path)

		if os.path.exists(filePath) : 

			if categories == 'Open' : 
				if command == 'Open' : 
					hook.openFile(filePath)

				if command == 'Open as work file' : 
					workFile = asset.nextVersion(asset.department(), asset.task())
					hook.openFile(filePath)
					hook.saveFile(workFile)
					# print workFile

			if categories == 'Import' : 
				if command == 'Import' : 
					hook.importFile(filePath)

				if command == 'Import to new file' : 
					hook.newFile()
					hook.importFile(filePath)

			if categories == 'Reference' : 
				namespace = asset.name()

				if command == 'Reference' : 
					hook.createReference(namespace, filePath)

				if command == 'Reference to new file' : 
					hook.newFile()
					hook.createReference(namespace, filePath)

		else : 
			self.messageBox('Error', 'File %s not exists' % filePath)
Exemplo n.º 20
0
def main() :
    # init maya standalone
    # set arguments 

    src = sys.argv[1]
    dst = sys.argv[2]
    cmdsRaw = sys.argv[3]
    content = sys.argv[4]
    output = sys.argv[5]

    cmds = eval(cmdsRaw)
    asset = entityInfo.info(src)

    # open scene 
    mc.file(src, o = True, f = True)

    for cmd in cmds : 
        # if cmd in setting.cmdList.keys() : 
            # print 'run %s' % setting.cmdList[cmd]
            # eval(setting.cmdList[cmd])
        cmd = 'rigCmd.%s()' % cmd
        eval(cmd)

    print 'run complete'

    if output == 'save' : 
        # save file 
        mc.file(rename = dst)
        mc.file(save = True, f = True, type = 'mayaAscii')
        print 'File saved'

    if output == 'export' : 
        if mc.objExists(content) : 
            mc.select(content)
            mc.file(dst, f = True, options = 'v=0', type = 'mayaAscii', pr = True, es = True)
            print 'File exported'
Exemplo n.º 21
0
 def refreshData(self):
     self.asset = entityInfo.info()
     self.workFile = self.asset.thisScene()
Exemplo n.º 22
0
 def refreshData(self) : 
     self.asset = entityInfo.info()
     self.workFile = self.asset.thisScene()