Exemple #1
0
	def loadData(self, dataPath) : 
		data = None 

		if os.path.exists(dataPath) : 
			data = fileUtils.ymlLoader(dataPath)

		return data 
Exemple #2
0
	def addAssetLog(self, namespace, cacheGrp) : 
		path = setting.cachePathInfo()
		assetLogPath = path['assetLogPath']
		assetPath = str(hook.getReferencePath(cacheGrp))
		timeInfo = hook.getShotRange()
		startFrame = timeInfo[0]
		endFrame = timeInfo[1]
		namespace = str(namespace)

		data = dict()
		assetData = dict() 

		if os.path.exists(assetLogPath) : 
			data = fileUtils.ymlLoader(assetLogPath)

		if 'asset' in data.keys() : 
			if namespace in data['asset'].keys() : 
				data['asset'][namespace] = assetPath

			else : 
				data['asset'].update({namespace: assetPath})

		else : 
			data.update({'asset': {namespace: assetPath}})

		if 'duration' in data.keys() : 
			data['duration'].update({'startFrame': startFrame, 'endFrame': endFrame})

		else : 
			data.update({'duration': {'startFrame': startFrame, 'endFrame': endFrame}})

		self.writeData(assetLogPath, data)
Exemple #3
0
	def removeNonCache(self) : 
		nonCacheFile = self.getCachePathInfo(True)['nonCacheDataPath']

		listWidget = 'nonCache_listWidget'
		items = self.getSelectedItems(listWidget)

		# remove from file 

		if items : 
			if os.path.exists(nonCacheFile) : 
				data = fileUtils.ymlLoader(nonCacheFile)
				
				for each in items : 
					grp = each[0]

					if 'nonCache' in data.keys() : 
						if grp in data['nonCache'] : 
							data['nonCache'].remove(grp)

			else : 
				data = {'nonCache': selItems}

			fileUtils.ymlDumper(nonCacheFile, data)

		self.refreshUI()
Exemple #4
0
	def addAssetLog(self, namespace, cacheGrp) : 
		path = setting.cachePathInfo()
		assetLogPath = path['assetLogPath']
		assetPath = str(hook.getReferencePath(cacheGrp))
		timeInfo = hook.getShotRange()
		startFrame = timeInfo[0]
		endFrame = timeInfo[1]
		namespace = str(namespace)

		data = dict()
		assetData = dict() 

		if os.path.exists(assetLogPath) : 
			data = fileUtils.ymlLoader(assetLogPath)

		if 'asset' in data.keys() : 
			if namespace in data['asset'].keys() : 
				data['asset'][namespace] = assetPath

			else : 
				data['asset'].update({namespace: assetPath})

		else : 
			data.update({'asset': {namespace: assetPath}})

		if 'duration' in data.keys() : 
			data['duration'].update({'startFrame': startFrame, 'endFrame': endFrame})

		else : 
			data.update({'duration': {'startFrame': startFrame, 'endFrame': endFrame}})

		self.writeData(assetLogPath, data)
Exemple #5
0
	def doImportNonCache(self) : 
		# import Non Cache 
		logger.debug('run apply non cache')


		# read asset
		listWidget = 'nonCache_tableWidget'
		nonCacheDataFile = self.setting['nonCacheDataPath']
		data = dict()

		if os.path.exists(nonCacheDataFile) : 
			data = fileUtils.ymlLoader(nonCacheDataFile)

		assetNames = self.getTableData(listWidget, self.nonCacheListCol)

		for each in assetNames : 
			assetName = each 
			if data : 
				exportGrp = data[assetName]['exportGrp']
				filePath = data[assetName]['filePath']

				if not hook.objectExists(exportGrp) : 
					if os.path.exists(filePath) : 
						hook.importFile(filePath)

					else : 
						logger.debug('Path does not exists %s' % filePath)

				else : 
					logger.debug('%s already in the scene' % exportGrp)

			else : 
				logger.error('Error check %s' % nonCacheDataFile)

		self.refreshUI()
Exemple #6
0
    def loadData(self, dataPath):
        data = None

        if os.path.exists(dataPath):
            data = fileUtils.ymlLoader(dataPath)

        return data
Exemple #7
0
	def setNonCacheList(self) : 
		# read data 
		if self.setting : 
			nonCacheDataFile = self.setting['nonCacheDataPath']
			widget = 'nonCache_tableWidget'
			self.clearTable(widget)

			if os.path.exists(nonCacheDataFile) : 
				data = fileUtils.ymlLoader(nonCacheDataFile)

				row = 0
				height = 20
				for each in data : 
					assetName = each 
					exportGrp = data[each]['exportGrp']
					filePath = data[each]['filePath']
					status = 'No'
					statusIcon = self.xIcon

					if hook.objectExists(exportGrp) : 
						status = 'Yes'
						statusIcon = self.okIcon

					self.insertRow(row, height, widget)
					self.fillInTable(row, self.nonCacheListCol, assetName, widget, [0, 0, 0])
					self.fillInTableIcon(row, self.nonCahceInSceneCol, status, statusIcon, widget, [0, 0, 0])

					row += 1 
Exemple #8
0
    def removeNonCache(self):
        nonCacheFile = self.getCachePathInfo(True)['nonCacheDataPath']

        listWidget = 'nonCache_listWidget'
        items = self.getSelectedItems(listWidget)

        # remove from file

        if items:
            if os.path.exists(nonCacheFile):
                data = fileUtils.ymlLoader(nonCacheFile)

                for each in items:
                    grp = each[0]

                    if 'nonCache' in data.keys():
                        if grp in data['nonCache']:
                            data['nonCache'].remove(grp)

            else:
                data = {'nonCache': selItems}

            fileUtils.ymlDumper(nonCacheFile, data)

        self.refreshUI()
Exemple #9
0
	def addTimeLog(self, inputType, namespace, duration) : 
		path = setting.cachePathInfo()
		timeLogPath = path['timeLogPath']
		namespace = str(namespace)
		duration = str(duration)

		data = dict()

		if os.path.exists(timeLogPath) : 
			data = fileUtils.ymlLoader(timeLogPath)

		if inputType == 'asset' : 
			if inputType in data.keys() : 
				if namespace in data[inputType].keys() : 
					data[inputType][namespace].append(duration)

				else : 
					data[inputType].update({namespace: [duration]})

			else : 
				data.update({inputType: {namespace: [duration]}})

		if inputType == 'shot' : 
			if inputType in data.keys() : 
				data[inputType].append(duration)

			else : 
				data.update({inputType: [duration]})


		self.writeData(timeLogPath, data)
Exemple #10
0
    def addTimeLog(self, inputType, namespace, duration):
        path = setting.cachePathInfo()
        timeLogPath = path['timeLogPath']
        namespace = str(namespace)
        duration = str(duration)

        data = dict()

        if os.path.exists(timeLogPath):
            data = fileUtils.ymlLoader(timeLogPath)

        if inputType == 'asset':
            if inputType in data.keys():
                if namespace in data[inputType].keys():
                    data[inputType][namespace].append(duration)

                else:
                    data[inputType].update({namespace: [duration]})

            else:
                data.update({inputType: {namespace: [duration]}})

        if inputType == 'shot':
            if inputType in data.keys():
                data[inputType].append(duration)

            else:
                data.update({inputType: [duration]})

        self.writeData(timeLogPath, data)
Exemple #11
0
	def readingCacheData(self) : 
		# read asset list 
		if self.setting : 
			dataPath = self.setting['cacheInfoPath']

			if os.path.exists(dataPath) : 
				data = fileUtils.ymlLoader(dataPath)

				return data
Exemple #12
0
    def paste(self):
        path = str(self.ui.pathLineEdit.text())
        item = self.ui.copyListWidget.currentItem()
        name = str(item.text())
        ars = []

        logPath = '%s/%s' % (path, name)

        if os.path.exists(logPath):
            log = fileUtils.ymlLoader(logPath)

            for ar in log.keys():
                adName = log[ar]['definition'].split('/')[-1].split('_AD')[0]
                if mc.objExists('%s*' % (adName)):
                    num = len(mc.ls('%s*' % (adName))) + 1
                else:
                    num = 1

                arName = asmUtils.createARNode('%s%d_AD_AR' % (adName, num))
                asmUtils.setARDefinitionPath(arName, log[ar]['definition'])

                mc.setAttr('%s.t' % arName, log[ar]['t'][0], log[ar]['t'][1],
                           log[ar]['t'][2])
                mc.setAttr('%s.r' % arName, log[ar]['r'][0], log[ar]['r'][1],
                           log[ar]['r'][2])
                mc.setAttr('%s.s' % arName, log[ar]['s'][0], log[ar]['s'][1],
                           log[ar]['s'][2])

                if log[ar]['type'] == 'parent':
                    asmUtils.setActiveRep(arName, 'AR')
                    gpuList = mc.listRelatives(arName, children=True)

                    for child in log[ar]['child'].keys():
                        mc.setAttr(
                            '%s_NS:%s.t' % (arName, child.split(':')[-1]),
                            log[ar]['child'][child]['t'][0],
                            log[ar]['child'][child]['t'][1],
                            log[ar]['child'][child]['t'][2])
                        mc.setAttr(
                            '%s_NS:%s.r' % (arName, child.split(':')[-1]),
                            log[ar]['child'][child]['r'][0],
                            log[ar]['child'][child]['r'][1],
                            log[ar]['child'][child]['r'][2])
                        mc.setAttr(
                            '%s_NS:%s.s' % (arName, child.split(':')[-1]),
                            log[ar]['child'][child]['s'][0],
                            log[ar]['child'][child]['s'][1],
                            log[ar]['child'][child]['s'][2])

                asmUtils.setAllActiveRep(arName)
                ars.append(arName)

            mc.select(ars)

        if self.ui.delAfterCheckBox.isChecked():
            os.remove(logPath)
    def readPreset(self):
        data = None

        if not os.path.exists(self.presetPath):
            data = {'Default': [], 'Examples': ['clean']}

            fileUtils.checkDir(self.presetPath)
            fileUtils.ymlDumper(self.presetPath, data)

        else:
            data = fileUtils.ymlLoader(self.presetPath)

        return data
Exemple #14
0
    def readPreset(self) : 
        data = None 

        if not os.path.exists(self.presetPath) : 
            data = {'Default': [], 'Examples': ['clean']}

            fileUtils.checkDir(self.presetPath)
            fileUtils.ymlDumper(self.presetPath, data)

        else : 
            data = fileUtils.ymlLoader(self.presetPath)

        return data
Exemple #15
0
    def writeStatus(self):
        logger.debug('start record status ...')

        dataPath = self.getCachePathInfo(True)['dataPath']
        statusInfo = dict()

        if not os.path.exists(os.path.dirname(dataPath)):
            os.makedirs(os.path.dirname(dataPath))

        if os.path.exists(dataPath):
            statusInfo = fileUtils.ymlLoader(dataPath)

        cacheListWidget = 'cache_listWidget'
        cacheTexts = self.getAllItems(cacheListWidget)
        cacheText1 = cacheTexts[0]
        cacheText2 = cacheTexts[1]

        if cacheText1 and cacheText2:
            for i in range(len(cacheText1)):
                namespace = cacheText1[i]
                rigGrp = cacheText2[i]

                statusInfo.update({
                    rigGrp: {
                        'namespace': namespace,
                        'status': 'cache',
                        'rigGrp': rigGrp
                    }
                })

        nonCacheListWidget = 'nonCache_listWidget'
        nonCacheTexts = self.getAllItems(nonCacheListWidget)
        nonCacheText1 = nonCacheTexts[0]
        nonCacheText2 = nonCacheTexts[1]

        if nonCacheText1 and nonCacheText2:
            for i in range(len(nonCacheText1)):
                namespace = nonCacheText1[i]
                rigGrp = nonCacheText2[i]

                statusInfo.update({
                    rigGrp: {
                        'namespace': namespace,
                        'status': 'nonCache',
                        'rigGrp': rigGrp
                    }
                })

        result = fileUtils.ymlDumper(dataPath, statusInfo)

        logger.debug('write status info %s' % dataPath)
Exemple #16
0
    def loadList(self) : 
        if os.path.exists(self.listFile) : 
            data = fileUtils.ymlLoader(self.listFile)

            if data : 
                self.data = data
                self.shotList = data['shot']
                self.assetDict = data['asset']
                self.assemblyDict = data['assembly']
                self.dstPath = data['dstPath']
                self.textureDict = data['texture']

                self.loadShotList()
                self.setDisplayAssetTable()
Exemple #17
0
	def doRemoveNonCacheAsset(self) : 
		listWidget = 'nonCache_tableWidget'
		assetNames = self.getTableData(listWidget, self.nonCacheListCol)

		nonCacheDataFile = self.setting['nonCacheDataPath']

		data = fileUtils.ymlLoader(nonCacheDataFile)

		for each in assetNames : 
			exportGrp = data[each]['exportGrp']
			hook.removeReference(exportGrp)


		self.refreshUI()
    def readDataPath(self):
        data = None
        if os.path.exists(self.dataPath):
            data = fileUtils.ymlLoader(self.dataPath)

        else:
            data = {'commands': []}

            if not os.path.exists(os.path.dirname(self.dataPath)):
                os.makedirs(os.path.dirname(self.dataPath))

            result = fileUtils.ymlDumper(self.dataPath, data)
            return self.readDataPath()

        return data
Exemple #19
0
    def readDataPath(self) : 
        data = None
        if os.path.exists(self.dataPath) : 
            data = fileUtils.ymlLoader(self.dataPath)

        else : 
            data = {'commands': []}

            if not os.path.exists(os.path.dirname(self.dataPath)) : 
                os.makedirs(os.path.dirname(self.dataPath))

            result = fileUtils.ymlDumper(self.dataPath, data)
            return self.readDataPath()

        return data
Exemple #20
0
	def setNoncacheList(self) : 
		if self.getCachePathInfo(True) : 
			nonCacheFile = self.getCachePathInfo(True)['nonCacheDataPath']
			bgColor = [0, 20, 60]
			text3 = ''

			if os.path.exists(nonCacheFile) : 
				data = fileUtils.ymlLoader(nonCacheFile)

				if 'nonCache' in data.keys() : 
					for each in data['nonCache'] : 
						if not hook.objectExists(each) : 
							bgColor = [100, 20, 20]
							text3 = 'not exists'

						self.addNonCacheListWidget(each, self.nonCacheAsset, text3, bgColor, self.rdyIcon, self.iconSize)
Exemple #21
0
    def setNoncacheList(self):
        if self.getCachePathInfo(True):
            nonCacheFile = self.getCachePathInfo(True)['nonCacheDataPath']
            bgColor = [0, 20, 60]
            text3 = ''

            if os.path.exists(nonCacheFile):
                data = fileUtils.ymlLoader(nonCacheFile)

                if 'nonCache' in data.keys():
                    for each in data['nonCache']:
                        if not hook.objectExists(each):
                            bgColor = [100, 20, 20]
                            text3 = 'not exists'

                        self.addNonCacheListWidget(each, self.nonCacheAsset,
                                                   text3, bgColor,
                                                   self.rdyIcon, self.iconSize)
Exemple #22
0
def importData(*arg):

    path = mc.file(q=True, sn=True)
    scalePath = path.split('animClean/')[0] + 'anim/cache/_assemblyScale.yml'

    if os.path.exists(scalePath):

        data = fileUtils.ymlLoader(scalePath)

        for i, v in data.iteritems():
            if mc.objExists('%s' % (i.split(':')[-1])):
                sels = mc.ls('%s' % (i.split(':')[-1]))
                #print sels
                for child in mc.listRelatives(sels[0], c=True):
                    if 'Rig_Grp' in child:
                        mc.setAttr('%s.s' % (child), v['s'][0], v['s'][1],
                                   v['s'][2])

    else:
        print 'File is not found. ' + scalePath
Exemple #23
0
	def addNonCache(self) : 
		# add to file 
		nonCacheFile = self.getCachePathInfo(True)['nonCacheDataPath']
		selItems = hook.getSelectedObjs()

		if selItems : 
			self.writeStatus()
			if os.path.exists(nonCacheFile) : 
				data = fileUtils.ymlLoader(nonCacheFile)
				
				for each in selItems : 
					if 'nonCache' in data.keys() : 
						if not each in data['nonCache'] : 
							data['nonCache'].append(each)

			else : 
				data = {'nonCache': selItems}

			fileUtils.ymlDumper(nonCacheFile, data)

		self.refreshUI()
Exemple #24
0
    def addNonCache(self):
        # add to file
        nonCacheFile = self.getCachePathInfo(True)['nonCacheDataPath']
        selItems = hook.getSelectedObjs()

        if selItems:
            self.writeStatus()
            if os.path.exists(nonCacheFile):
                data = fileUtils.ymlLoader(nonCacheFile)

                for each in selItems:
                    if 'nonCache' in data.keys():
                        if not each in data['nonCache']:
                            data['nonCache'].append(each)

            else:
                data = {'nonCache': selItems}

            fileUtils.ymlDumper(nonCacheFile, data)

        self.refreshUI()
Exemple #25
0
	def doImportCamera(self) : 
		cameraPath = self.setting['cameraPath']
		cameraInfoPath = self.setting['cameraInfoPath']
		shotCameraName = self.setting['shotCameraName']
		cameraInfoPath = self.setting['cameraInfoPath']

		if not hook.objectExists(shotCameraName) : 
			if os.path.exists(cameraPath) : 
				hook.importFile(cameraPath)
				hook.fixSequencer()

		if os.path.exists(cameraInfoPath) : 
			range = fileUtils.ymlLoader(cameraInfoPath)

			if range : 
				currentShot = self.shotInfo.getShotName()
				min = range[currentShot]['startFrame']
				max = range[currentShot]['endFrame']
				hook.setShotRange(min, max)

		self.checkDataStatus()
Exemple #26
0
	def writeStatus(self) : 
		logger.debug('start record status ...')

		dataPath = self.getCachePathInfo(True)['dataPath']
		statusInfo = dict()

		if not os.path.exists(os.path.dirname(dataPath)) : 
			os.makedirs(os.path.dirname(dataPath))

		if os.path.exists(dataPath) : 
			statusInfo = fileUtils.ymlLoader(dataPath)
		
		cacheListWidget = 'cache_listWidget'
		cacheTexts = self.getAllItems(cacheListWidget)
		cacheText1 = cacheTexts[0]
		cacheText2 = cacheTexts[1]

		if cacheText1 and cacheText2 : 
			for i in range(len(cacheText1)) : 
				namespace = cacheText1[i]
				rigGrp = cacheText2[i]

				statusInfo.update({rigGrp: {'namespace': namespace, 'status': 'cache', 'rigGrp': rigGrp}})


		nonCacheListWidget = 'nonCache_listWidget'
		nonCacheTexts = self.getAllItems(nonCacheListWidget)
		nonCacheText1 = nonCacheTexts[0]
		nonCacheText2 = nonCacheTexts[1]

		if nonCacheText1 and nonCacheText2 : 
			for i in range(len(nonCacheText1)) : 
				namespace = nonCacheText1[i]
				rigGrp = nonCacheText2[i]

				statusInfo.update({rigGrp: {'namespace': namespace, 'status': 'nonCache', 'rigGrp': rigGrp}})

		result = fileUtils.ymlDumper(dataPath, statusInfo)

		logger.debug('write status info %s' % dataPath)
Exemple #27
0
 def read_cache(self):
     dataFile = self.data_file()
     if os.path.exists(dataFile):
         data = fileUtils.ymlLoader(dataFile)
         return data
Exemple #28
0
    def assignAssetStatus(self, mode):

        logger.debug('=====================')
        logger.debug('assignAssetStatus ...')

        rigGrps = []
        addGrps = []
        notAddGrps = []

        # send to cache
        if mode == 'cache':
            logger.debug('cache mode')
            listWidget = 'nonCache_listWidget'
            items = self.getSelectedItems(listWidget)

            logger.debug(items)

            if items:
                rigGrps = items[1]

        # send to non cache
        if mode == 'nonCache':
            logger.debug('nonCache mode')
            listWidget = 'cache_listWidget'
            items = self.getSelectedItems(listWidget)

            logger.debug(items)

            if items:
                rigGrps = items[1]

        if rigGrps:
            self.writeStatus()
            dataPath = self.getCachePathInfo(True)['dataPath']

            if dataPath:
                data = fileUtils.ymlLoader(dataPath)

                if data:
                    for each in rigGrps:
                        if each in data.keys():
                            if not each == self.nonCacheAsset:
                                data[each]['status'] = mode
                                addGrps.append(each)

                            else:
                                notAddGrps.append(each)

                    logger.debug('writing data back')
                    fileUtils.ymlDumper(dataPath, data)

                    # refresh UI
                    self.refreshUI()

                    if addGrps:
                        display = (', ').join(addGrps)
                        logger.info('%s added to %s' % (display, mode))

                    if notAddGrps:
                        display = (', ').join(notAddGrps)
                        logger.info('%s cannot be added to %s' %
                                    (display, mode))

        else:
            logger.warning('no items selected')
Exemple #29
0
	def assignAssetStatus(self, mode) : 

		logger.debug('=====================')		
		logger.debug('assignAssetStatus ...')		

		rigGrps = []
		addGrps = []
		notAddGrps = []

		# send to cache 
		if mode == 'cache' : 
			logger.debug('cache mode')
			listWidget = 'nonCache_listWidget'
			items = self.getSelectedItems(listWidget)

			logger.debug(items)

			if items : 
				rigGrps = items[1]

		# send to non cache 
		if mode == 'nonCache' : 
			logger.debug('nonCache mode')
			listWidget = 'cache_listWidget'
			items = self.getSelectedItems(listWidget)

			logger.debug(items)

			if items : 
				rigGrps = items[1]

		if rigGrps : 
			self.writeStatus()
			dataPath = self.getCachePathInfo(True)['dataPath']

			if dataPath : 
				data = fileUtils.ymlLoader(dataPath)

				if data : 
					for each in rigGrps : 
						if each in data.keys() : 
							if not each == self.nonCacheAsset : 
								data[each]['status'] = mode
								addGrps.append(each)

							else : 
								notAddGrps.append(each)


					logger.debug('writing data back')
					fileUtils.ymlDumper(dataPath,data)
					
					# refresh UI
					self.refreshUI()

					if addGrps : 
						display = (', ').join(addGrps)
						logger.info('%s added to %s' % (display, mode))

					if notAddGrps : 
						display = (', ').join(notAddGrps)
						logger.info('%s cannot be added to %s' % (display, mode))


		else : 
			logger.warning('no items selected')