def writeData(self, id, assetName, user, assetPath, matteIdDict): # data structure ''' dictInfo = {0: {'assetName': 'defaultAsset', 'assetPath': assetPath, matteId': { 1: {'vrayMtl': 'vrayMtl1', 'color': 'red', 'multiMatte': 'Matte01'}, 2: {'vrayMtl': 'vrayMtl2', 'color': 'red', 'multiMatte': 'Matte02'}}}} ''' # assign current data writeBackData = self.readDatabase() writeBackData.update({ id: { 'assetName': assetName, 'assetPath': assetPath, 'user': user, 'matteId': matteIdDict } }) dbPath = self.getDbPath() result = fileUtils.ymlDumper(dbPath, writeBackData) return result
def createDefaultDatabase(self, dbPath): dictInfo = { 0: { 'assetName': 'defaultAsset', 'user': '******', 'assetPath': '-', 'matteId': { 1: { 'vrayMtl': 'vrayMtl1', 'color': 'red', 'multiMatte': 'Matte01' }, 2: { 'vrayMtl': 'vrayMtl2', 'color': 'red', 'multiMatte': 'Matte02' } } } } dirname = os.path.dirname(dbPath) if not os.path.exists(dirname): os.makedirs(dirname) result = fileUtils.ymlDumper(dbPath, dictInfo) return result
def removeData(self, id): currentData = self.readDatabase() dbPath = self.getDbPath() if id in currentData.keys(): del currentData[id] result = fileUtils.ymlDumper(dbPath, currentData) return result
def createDefaultDatabase(self, dbPath) : dictInfo = {0: {'assetName': 'defaultAsset', 'user': '******', 'assetPath': '-', 'matteId': { 1: {'vrayMtl': 'vrayMtl1', 'color': 'red', 'multiMatte': 'Matte01'}, 2: {'vrayMtl': 'vrayMtl2', 'color': 'red', 'multiMatte': 'Matte02'} } } } dirname = os.path.dirname(dbPath) if not os.path.exists(dirname) : os.makedirs(dirname) result = fileUtils.ymlDumper(dbPath, dictInfo) return result
def writeData(self, id, assetName, user, assetPath): # data structure """ dictInfo = {0: {'assetName': 'defaultAsset', 'assetPath': assetPath, matteId': { 1: {'vrayMtl': 'vrayMtl1', 'color': 'red', 'multiMatte': 'Matte01'}, 2: {'vrayMtl': 'vrayMtl2', 'color': 'red', 'multiMatte': 'Matte02'}}}} """ # assign current data writeBackData = self.readDatabase() writeBackData.update({id: {"assetName": assetName, "assetPath": assetPath, "user": user}}) dbPath = self.getDbPath() result = fileUtils.ymlDumper(dbPath, writeBackData) return result
def createDefaultDatabase(self, dbPath): dictInfo = { 0: { "assetName": "defaultAsset", "user": "******", "assetPath": "-", "matteId": { 1: {"vrayMtl": "vrayMtl1", "color": "red", "multiMatte": "Matte01"}, 2: {"vrayMtl": "vrayMtl2", "color": "red", "multiMatte": "Matte02"}, }, } } dirname = os.path.dirname(dbPath) if not os.path.exists(dirname): os.makedirs(dirname) result = fileUtils.ymlDumper(dbPath, dictInfo) return result