예제 #1
0
	def collectCacheVersion(self) : 
		versions = []

		if self.setting : 
			cachePath = self.setting['cachePath']
			cacheInfo = dict()

			if os.path.exists(cachePath) : 
				versions = fileUtils.listFolder(cachePath)

				for version in versions : 
					files = fileUtils.listFile(os.path.join(cachePath, version))
					assetNames = [os.path.splitext(a)[0] for a in files]

					i = 0 
					for eachFile in assetNames : 
						assetName = eachFile 

						if not assetName in cacheInfo.keys() : 
							cacheInfo.update({assetName: {'versions': [version], 'versionKey': {version: os.path.join(cachePath, version, files[i])}}})

						else : 
							cacheInfo[assetName]['versions'].append(version)
							cacheInfo[assetName]['versionKey'].update({version: os.path.join(cachePath, version, files[i])})

						i += 1 


			return cacheInfo
예제 #2
0
    def setSubTypeUI(self):
        crSubType = str()
        if self.info:
            crSubType = self.info['assetSubtype']

        project = str(self.ui.project_comboBox.currentText())
        selType = str(self.ui.type_comboBox.currentText())

        path = '%s%s/asset/3D/%s' % (self.drive, project, selType)
        subTypes = fileUtils.listFolder(path)

        self.ui.subType_comboBox.clear()

        i = 0
        index = 0

        for each in subTypes:
            self.ui.subType_comboBox.addItem(each)

            if each == crSubType:
                index = i

            i += 1

        self.ui.subType_comboBox.setCurrentIndex(index)
예제 #3
0
    def listAssetUI(self):
        crAsset = str()
        if self.info:
            crAsset = self.info['assetName']

        project = str(self.ui.project_comboBox.currentText())
        selType = str(self.ui.type_comboBox.currentText())
        selSubType = str(self.ui.subType_comboBox.currentText())

        path = '%s%s/asset/3D/%s/%s' % (self.drive, project, selType,
                                        selSubType)
        assets = fileUtils.listFolder(path)

        self.ui.asset_comboBox.clear()

        index = 0
        i = 0

        for each in assets:
            self.ui.asset_comboBox.addItem(each)

            if each == crAsset:
                index = i

            i += 1

        self.ui.asset_comboBox.setCurrentIndex(index)
예제 #4
0
	def setSubTypeUI(self) : 
		crSubType = str() 
		if self.info : 
			crSubType = self.info['assetSubtype']

		project = str(self.ui.project_comboBox.currentText())
		selType = str(self.ui.type_comboBox.currentText())

		path = '%s%s/asset/3D/%s' % (self.drive, project, selType)
		subTypes = fileUtils.listFolder(path)

		self.ui.subType_comboBox.clear()

		i = 0 
		index = 0 

		for each in subTypes : 
			self.ui.subType_comboBox.addItem(each)

			if each == crSubType : 
				index = i 

			i += 1 

		self.ui.subType_comboBox.setCurrentIndex(index)
예제 #5
0
	def listAssetUI(self) : 
		crAsset = str() 
		if self.info : 
			crAsset = self.info['assetName']

		project = str(self.ui.project_comboBox.currentText())
		selType = str(self.ui.type_comboBox.currentText())
		selSubType = str(self.ui.subType_comboBox.currentText())

		path = '%s%s/asset/3D/%s/%s' % (self.drive, project, selType, selSubType)
		assets = fileUtils.listFolder(path)

		self.ui.asset_comboBox.clear()

		index = 0 
		i = 0 

		for each in assets : 
			self.ui.asset_comboBox.addItem(each)

			if each == crAsset : 
				index = i 

			i += 1 

		self.ui.asset_comboBox.setCurrentIndex(index)
예제 #6
0
파일: app.py 프로젝트: myCodeTD/ptAlembic
	def manageCacheData(self, action) : 
		logger.debug('def manageCacheData')
		increment = self.ui.increment_checkBox.isChecked()
		path = self.getCachePathInfo(increment)
		
		if action == 'view' : 
			logger.debug(' - action %s' % action)
			cachePath = path['cacheDir']
			logger.debug(cachePath)

			if os.path.exists(cachePath) : 
				subprocess.Popen(r'explorer /e,"%s"' % cachePath.replace('/', '\\'))

			else : 
				self.messageBox('Path not exists', '%s not exists' % cachePath)


		if action == 'clearAll' : 
			logger.debug(' - action %s'% action)
			cachePath = path['cacheDir']

			if os.path.exists(cachePath) : 
				dirs = fileUtils.listFolder(cachePath)
				logger.debug(' - %s' % dirs)

				if dirs : 
					for eachDir in dirs : 
						removeDir = '%s/%s' % (cachePath, eachDir)
						shutil.rmtree(removeDir)
						logger.info('Remove %s' % removeDir)

					self.messageBox('Success', 'All caches data removed')

				else : 
					self.messageBox('Warning', 'No cache data to remove')
예제 #7
0
    def manageCacheData(self, action):
        logger.debug('def manageCacheData')
        increment = self.ui.increment_checkBox.isChecked()
        path = self.getCachePathInfo(increment)

        if action == 'view':
            logger.debug(' - action %s' % action)
            cachePath = path['cacheDir']
            logger.debug(cachePath)

            if os.path.exists(cachePath):
                subprocess.Popen(r'explorer /e,"%s"' %
                                 cachePath.replace('/', '\\'))

            else:
                self.messageBox('Path not exists', '%s not exists' % cachePath)

        if action == 'clearAll':
            logger.debug(' - action %s' % action)
            cachePath = path['cacheDir']

            if os.path.exists(cachePath):
                dirs = fileUtils.listFolder(cachePath)
                logger.debug(' - %s' % dirs)

                if dirs:
                    for eachDir in dirs:
                        removeDir = '%s/%s' % (cachePath, eachDir)
                        shutil.rmtree(removeDir)
                        logger.info('Remove %s' % removeDir)

                    self.messageBox('Success', 'All caches data removed')

                else:
                    self.messageBox('Warning', 'No cache data to remove')
예제 #8
0
	def setPathUI(self, path) : 
		if os.path.exists(path) : 
			self.setLabel(True)
			dirs = fileUtils.listFolder(path)

		else : 
			self.setLabel(False)
			logger.info('%s not exists' % path)
예제 #9
0
	def getProjectList(self) : 
		sgProjects = sgUtils.sgGetProjects()
		svProjects = fileUtils.listFolder(self.server)
		projects = dict()

		for each in sgProjects : 
			projName = each['name']

			for eachFilter in self.projectFilters : 
				if eachFilter in projName and projName in svProjects : 
					projects.update({projName: {'type': 'Project', 'id': each['id']}})

		return projects 
예제 #10
0
파일: ptm_app3.py 프로젝트: myCodeTD/ptm
	def getProjectList(self) : 
		sgProjects = sgUtils.sgGetProjects()
		svProjects = fileUtils.listFolder(self.server)
		projects = dict()

		for each in sgProjects : 
			projName = each['name']

			for eachFilter in self.projectFilters : 
				if eachFilter in projName and projName in svProjects : 
					projects.update({projName: {'type': 'Project', 'id': each['id']}})

		return projects 
예제 #11
0
    def setRes(self, path):
        res = fileUtils.listFolder(path)

        self.ui.renderRes_comboBox.clear()
        self.ui.animRes_comboBox.clear()

        if res:
            self.ui.render_pushButton.setEnabled(True)
            self.ui.anim_pushButton.setEnabled(True)

        i = 0
        for each in res:
            self.ui.renderRes_comboBox.addItem(each)
            self.ui.animRes_comboBox.addItem(each)

            i += 1

        self.ui.renderRes_comboBox.setCurrentIndex(i - 1)
예제 #12
0
	def setRes(self, path) : 
		res = fileUtils.listFolder(path)

		self.ui.renderRes_comboBox.clear()
		self.ui.animRes_comboBox.clear()

		if res : 
			self.ui.render_pushButton.setEnabled(True)
			self.ui.anim_pushButton.setEnabled(True)

		i = 0 
		for each in res : 
			self.ui.renderRes_comboBox.addItem(each)
			self.ui.animRes_comboBox.addItem(each)

			i += 1 

		self.ui.renderRes_comboBox.setCurrentIndex(i-1)
예제 #13
0
	def doCopyTexture(self) : 
		src = self.textureTemplate 
		dst = self.texturePath

		res = fileUtils.listFolder(src)

		if os.path.exists(dst) : 
			try : 
				for each in res : 
					src2 = '%s/%s' % (src, each)
					dst2 = '%s/%s' % (dst, each)

					result = fileUtils.copyTree(src2, dst2)
					print result 

				self.messageBox('Complete', 'Copy Texture Complete')

			except Exception as e : 
				print e 
				self.messageBox('Error', str(e))
예제 #14
0
    def doCopyTexture(self):
        src = self.textureTemplate
        dst = self.texturePath

        res = fileUtils.listFolder(src)

        if os.path.exists(dst):
            try:
                for each in res:
                    src2 = '%s/%s' % (src, each)
                    dst2 = '%s/%s' % (dst, each)

                    result = fileUtils.copyTree(src2, dst2)
                    print result

                self.messageBox('Complete', 'Copy Texture Complete')

            except Exception as e:
                print e
                self.messageBox('Error', str(e))
예제 #15
0
	def setProjectUI(self) : 
		crProject = str()
		if self.info : 
			crProject = self.info['projectName']

		projects = fileUtils.listFolder(self.drive)
		self.ui.project_comboBox.clear()

		index = 0 
		i = 0 

		for each in projects : 
			if not each[0] in self.projectSkipKey and each.split('_')[0] in self.projectPrefix : 
				self.ui.project_comboBox.addItem(each)

				if each == crProject : 
					index = i 

				i += 1 

		self.ui.project_comboBox.setCurrentIndex(index)
예제 #16
0
def findVersion(cachePath, increment):
    dirs = fileUtils.listFolder(cachePath)
    versions = []

    for eachDir in dirs:
        if eachDir[0] == "v" and eachDir[1:].isdigit():
            intVersion = int(eachDir.replace("v", ""))
            versions.append(intVersion)

    if versions:
        maxVersion = sorted(versions)[-1]
        nextVersion = maxVersion

        if increment:
            nextVersion = maxVersion + 1

        strVersion = "v%03d" % nextVersion

    else:
        strVersion = "v001"

    return strVersion
예제 #17
0
def findVersion(cachePath, increment):
    dirs = fileUtils.listFolder(cachePath)
    versions = []

    for eachDir in dirs:
        if eachDir[0] == 'v' and eachDir[1:].isdigit():
            intVersion = int(eachDir.replace('v', ''))
            versions.append(intVersion)

    if versions:
        maxVersion = sorted(versions)[-1]
        nextVersion = maxVersion

        if increment:
            nextVersion = maxVersion + 1

        strVersion = 'v%03d' % nextVersion

    else:
        strVersion = 'v001'

    return strVersion
예제 #18
0
    def setProjectUI(self):
        crProject = str()
        if self.info:
            crProject = self.info['projectName']

        projects = fileUtils.listFolder(self.drive)
        self.ui.project_comboBox.clear()

        index = 0
        i = 0

        for each in projects:
            if not each[0] in self.projectSkipKey and each.split(
                    '_')[0] in self.projectPrefix:
                self.ui.project_comboBox.addItem(each)

                if each == crProject:
                    index = i

                i += 1

        self.ui.project_comboBox.setCurrentIndex(index)
예제 #19
0
    def setTypeUI(self):
        crType = str()
        if self.info:
            crType = self.info['assetType']

        project = str(self.ui.project_comboBox.currentText())

        path = '%s%s/asset/3D' % (self.drive, project)
        types = fileUtils.listFolder(path)
        self.ui.type_comboBox.clear()

        index = 0
        i = 0

        for each in types:
            self.ui.type_comboBox.addItem(each)

            if crType == each:
                index = i

            i += 1

        self.ui.type_comboBox.setCurrentIndex(index)
예제 #20
0
	def setTypeUI(self) : 
		crType = str()
		if self.info : 
			crType = self.info['assetType']

		project = str(self.ui.project_comboBox.currentText())

		path = '%s%s/asset/3D' % (self.drive, project)
		types = fileUtils.listFolder(path)
		self.ui.type_comboBox.clear() 

		index = 0 
		i = 0 

		for each in types : 
			self.ui.type_comboBox.addItem(each)

			if crType == each : 
				index = i 

			i += 1 

		self.ui.type_comboBox.setCurrentIndex(index)