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)
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)
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)
def doExportCamera(self) : info = dict() logger.debug('def doExportCamera') path = setting.cachePathInfo() cameraPath = path['cameraPath'] cameraInfoPath = path['cameraInfoPath'] # timeline timeRange = hook.getShotRange() startFrame = timeRange[0] endFrame = timeRange[1] # get sequencer to export sequencerShot = self.shot logger.debug(' shot name %s' % sequencerShot) if hook.objectExists(sequencerShot) : if not os.path.exists(os.path.dirname(cameraPath)) : os.makedirs(os.path.dirname(cameraPath)) hook.export(sequencerShot, cameraPath) self.ui.exportCam_pushButton.setEnabled(False) info.update({str(sequencerShot): {'startFrame': startFrame, 'endFrame': endFrame}}) self.writeData(cameraInfoPath, info) logger.debug(' Export complete') else : logger.debug(' Camera not exists')
def doRestoreList(self): logger.debug('def doRestoreList') path = setting.cachePathInfo() dataPath = path['dataPath'] if os.path.exists(dataPath): os.remove(dataPath) logger.debug(' removed %s' % dataPath) self.refreshUI() logger.info('Restore default list success')
def doRestoreList(self) : logger.debug('def doRestoreList') path = setting.cachePathInfo() dataPath = path['dataPath'] if os.path.exists(dataPath) : os.remove(dataPath) logger.debug(' removed %s' % dataPath) self.refreshUI() logger.info('Restore default list success')
def refreshUI(self) : logger.debug('=================') logger.debug('Refreshing UI ...') self.setSelShotData() self.setting = setting.cachePathInfo(True, self.project, self.episode, self.sequence, self.shot, self.dept) self.cacheData = self.readingCacheData() self.cacheVersions = self.collectCacheVersion() self.setCacheList() self.resizeColumn() self.setNonCacheList() self.setLodComboBox()
def exportData(assetName, exportPath): info = setting.cachePathInfo() configData = dict() sceneInfo = setting.getSceneInfo() dept = sceneInfo['department'] if info: if exportDept == dept: cachePath = info['cacheInfoPath'] shadeFile = str(getShaderPath(assetName)['shadeFile']) shadeDataFile = str(getShaderPath(assetName)['dataFile']) assetPath = str(getShaderPath(assetName)['assetFile']) cacheGrp = str('%s:%s' % (assetName, exportGrp)) assetDataPath = info['assetDataPath'] if os.path.exists(cachePath): config = open(cachePath, 'r') configData = yaml.load(config) if not os.path.exists(os.path.dirname(cachePath)): os.makedirs(os.path.dirname(cachePath)) print os.path.dirname(cachePath) fileInfo = open(cachePath, 'w') configData.update({ str(assetName): { 'shadeFile': shadeFile, 'shadeDataFile': shadeDataFile, 'cachePath': str(exportPath), 'assetPath': assetPath, 'cacheGrp': cacheGrp } }) result = yaml.dump(configData, fileInfo, default_flow_style=False) # export asset hierarchy if not os.path.exists(assetDataPath): os.makedirs(assetDataPath) # export asset data dataPath = '%s/%s.yml' % (assetDataPath, assetName) pipelineTools.exportHierarchyData(cacheGrp, dataPath) print dataPath
def exportData(assetName, exportPath) : info = setting.cachePathInfo() configData = dict() sceneInfo = setting.getSceneInfo() dept = sceneInfo['department'] if info : if exportDept == dept : cachePath = info['cacheInfoPath'] shadeFile = str(getShaderPath(assetName)['shadeFile']) shadeDataFile = str(getShaderPath(assetName)['dataFile']) assetPath = str(getShaderPath(assetName)['assetFile']) cacheGrp = str('%s:%s' % (assetName, exportGrp)) assetDataPath = info['assetDataPath'] if os.path.exists(cachePath) : config = open(cachePath, 'r') configData = yaml.load(config) if not os.path.exists(os.path.dirname(cachePath)) : os.makedirs(os.path.dirname(cachePath)) print os.path.dirname(cachePath) fileInfo = open(cachePath, 'w') configData.update({str(assetName): {'shadeFile': shadeFile, 'shadeDataFile': shadeDataFile, 'cachePath': str(exportPath), 'assetPath': assetPath, 'cacheGrp': cacheGrp}}) result = yaml.dump(configData, fileInfo, default_flow_style = False) # export asset hierarchy if not os.path.exists(assetDataPath) : os.makedirs(assetDataPath) # export asset data dataPath = '%s/%s.yml' % (assetDataPath, assetName) pipelineTools.exportHierarchyData(cacheGrp, dataPath) print dataPath
def doExportCamera(self): info = dict() logger.debug('def doExportCamera') path = setting.cachePathInfo() cameraPath = path['cameraPath'] cameraInfoPath = path['cameraInfoPath'] # timeline timeRange = hook.getShotRange() startFrame = timeRange[0] endFrame = timeRange[1] # get sequencer to export sequencerShot = self.shot logger.debug(' shot name %s' % sequencerShot) if hook.objectExists(sequencerShot): if not os.path.exists(os.path.dirname(cameraPath)): os.makedirs(os.path.dirname(cameraPath)) hook.export(sequencerShot, cameraPath) self.ui.exportCam_pushButton.setEnabled(False) info.update({ str(sequencerShot): { 'startFrame': startFrame, 'endFrame': endFrame } }) self.writeData(cameraInfoPath, info) logger.debug(' Export complete') else: logger.debug(' Camera not exists')
def getCachePathInfo(self, increment=True): return setting.cachePathInfo(increment)
def getCachePathInfo(self, increment = True) : return setting.cachePathInfo(increment)