def doApplyCache(self) : logger.debug('run apply cache') # read asset listWidget = 'asset_tableWidget' assetNames = self.getTableData(listWidget, self.cacheListCol) alwaysRebuild = True for assetName in assetNames : abcFile = self.cacheData[assetName]['cachePath'] cacheGrp = self.cacheData[assetName]['cacheGrp'] shadeDataFile = self.cacheData[assetName]['shadeDataFile'] shadeFile = self.cacheData[assetName]['shadeFile'] if os.path.exists(abcFile) and hook.objectExists(cacheGrp) : abcImport.applyCache(cacheGrp, abcFile, alwaysRebuild) logger.debug('set cache %s -> %s' % (cacheGrp, abcFile)) # automatic assign shade if alembic geo if not hook.isReference(cacheGrp) : importShade.applyRefShade(assetName, shadeFile, shadeDataFile) else : logger.debug('%s or %s not exists' % (abcFile, cacheGrp)) self.refreshUI()
def doRebuildAbcAsset(self) : # read asset listWidget = 'asset_tableWidget' assetNames = self.getTableData(listWidget, self.cacheListCol) assetPaths = self.getTableData(listWidget, self.assetPathCol) i = 0 for i in range(len(assetNames)) : assetName = assetNames[i] versions = sorted(self.cacheVersions[assetName]['versionKey'].keys()) latestVersion = self.cacheVersions[assetName]['versionKey'][versions[-1]] latestVersion = os.path.normpath(latestVersion).replace('\\', '/') # shade file shadeDataFile = self.cacheData[assetName]['shadeDataFile'] shadeFile = self.cacheData[assetName]['shadeFile'] # import ablembic abcImport.importCacheAsset(assetName, latestVersion) # assign shade importShade.applyRefShade(assetName, shadeFile, shadeDataFile) self.refreshUI()
def doImportShade() : asset = entityInfo.info() assetName = asset.name() refPath = asset.getPath('ref') shadeName = asset.getRefNaming('shade', showExt = False) shadeFile = '%s/%s.ma' % (refPath, shadeName) shadeDataFile = '%s/%s.yml' % (refPath, shadeName) if os.path.exists(shadeFile) and os.path.exists(shadeDataFile) : importShade.applyRefShade(assetName, shadeFile, shadeDataFile)
def doImportShade(): asset = entityInfo.info() assetName = asset.name() refPath = asset.getPath('ref') shadeName = asset.getRefNaming('shade', showExt=False) shadeFile = '%s/%s.ma' % (refPath, shadeName) shadeDataFile = '%s/%s.yml' % (refPath, shadeName) if os.path.exists(shadeFile) and os.path.exists(shadeDataFile): importShade.applyRefShade(assetName, shadeFile, shadeDataFile)
def applyCacheVersion(self, row, comboBox, arg = None) : listWidget = 'asset_tableWidget' version = str(comboBox.currentText()) assetNames = self.getColumnData(listWidget, self.cacheListCol) assetName = assetNames[row] cacheGrp = self.cacheData[assetName]['cacheGrp'] shadeDataFile = self.cacheData[assetName]['shadeDataFile'] shadeFile = self.cacheData[assetName]['shadeFile'] abcFile = self.cacheVersions[assetName]['versionKey'][version] if os.path.exists(abcFile) : # abcImport.logger.setLevel(DEBUG) abcImport.applyCache(cacheGrp, abcFile) # automatic assign shade if alembic geo if not hook.isReference(cacheGrp) : importShade.applyRefShade(assetName, shadeFile, shadeDataFile) else : logger.debug('abcFile not found %s' % abcFile) self.refreshUI()
def doConnectShade(self) : logger.debug('doConnectShade') listWidget = 'asset_tableWidget' assetNames = self.getTableData(listWidget, self.cacheListCol) assetPaths = self.getTableData(listWidget, self.assetPathCol) i = 0 for i in range(len(assetNames)) : assetName = assetNames[i] shadeDataFile = self.cacheData[assetNames[i]]['shadeDataFile'] shadeFile = self.cacheData[assetNames[i]]['shadeFile'] result = importShade.applyRefShade(assetName, shadeFile, shadeDataFile)