def save(self, file_path, name, user_comment=None): comment = '%s %s - asset' % (self.tool_kit_name, self.version) if user_comment: comment = '%s %s - asset\n%s' % (self.tool_kit_name, self.version, user_comment) created_date = datetime.now().strftime('%Y/%d/%B - %I:%M:%S:%p') description = 'This data contain information about asset' type = 'asset' valid = True format = self.get_format() data = {'name': name, 'path': self.path, 'format': format} tag = self.tool_kit_object rw = readWrite.ReadWrite(c=comment, cd=created_date, d=description, t=type, v=valid, data=data, tag=tag, path=file_path, name=name, format='asset') result, asset_path = rw.create() if False in result: return result studio_image = studioImage.ImageCalibration(path=file_path, name=name, format='png') image_path = studio_image.writeImage(self.image) print '\nresult', asset_path, image_path return result
def get_input_data(): category_path = resources.getInputPath(module='categories') rw = readWrite.ReadWrite(tag='categories') rw.file_path = category_path input_data = rw.get_data() order_data = rw.set_order(input_data) return input_data, order_data
def read_data(self, type, paths): rw = readWrite.ReadWrite(t='asset') rw.file_path = paths result = {True: None} asset_data = {} for each_path in self.paths: rw.file_path = each_path if type == 'info': data = rw.get_info() if type == 'data': data = rw.get_data() asset_data.setdefault(each_path, data) return asset_data
def __init__(self, parent=None, standalone=False): super(MainWindow, self).__init__(parent) self.standalone = standalone self.image_object = None self.width, self.height = [500, 500] self.publish_format = 'asset' self.image_format = 'png' self.tool_mode = 'publish' self.currnet_publish = None self.q_image, self.q_image_path = None, None self.source_file, self.source_file_path = None, None self.tool_kit_object, self.tool_kit_name, self.version = platforms.get_tool_kit( ) self.tool_kit_titile = '{} {}'.format(self.tool_kit_name, self.version) self.preference = preferences.Preference(parent=None) self.catalogue = catalogue.Catalogue(parent=None) self.asset = asset.Asset(parent=None) self.folder = studioFolder.Folder() # to check the preferencees resource_path = resources.getResourceTypes()['preference'].encode() self.rw = readWrite.ReadWrite(t='preference', path=resource_path, format='json', name='library_preferences', tag='asset_library') inputs = self.rw.get_inputs() self.create_type_values = ['None', 'import', 'reference'] self.maya_type_values = ['None', 'mayaAscii', 'mayaBinary'] self.maya_path = inputs[0] self.library_path = inputs[1] self.create_type = self.create_type_values[inputs[2]] self.maya_type = self.maya_type_values[inputs[3]] self.output_path = inputs[4] self.setup_ui() self.set_icons() self.load_library_folders(self.treewidget) if not self.standalone: self.parent_maya_layout() self.set_contex_menu() self.studio_print = studioPrint.Print(self.standalone, self.textedit_console)
def apply(self): directorys = self.get_source_paths(self.gridlayout) comment = '{} {} - preference container'.format( self.lable, self.version) created_date = datetime.now().strftime('%B/%d/%Y - %I:%M:%S:%p') description = 'This data contain information about asset library preference' type = 'preference' valid = True data = directorys tag = 'asset_library' resource_path = resources.getResourceTypes()[type] rw = readWrite.ReadWrite(c=comment, cd=created_date, d=description, t=type, v=valid, data=data, tag=tag, path=resource_path, name='library_preferences', format='json') rw.create() self.close() print '\n#result preferences updated ', rw.file_path
def create_preference(self): comment = '{} {} - preference container'.format( self.lable, self.version) created_date = datetime.now().strftime('%B/%d/%Y - %I:%M:%S:%p') description = 'This data contain information about asset library preference' type = 'preference' valid = True data = self.bundles tag = 'asset_library' resource_path = resources.getResourceTypes()[type].encode() rw = readWrite.ReadWrite(c=comment, cd=created_date, d=description, t=type, v=valid, data=data, tag=tag, path=resource_path, name='library_preferences', format='json') if rw.has_file(): self.bundles = rw.get_data() return rw.create()
def had_valid(self, publish_file): rw = readWrite.ReadWrite(t='asset') rw.file_path = publish_file result = rw.has_valid() return result
def had_file(self, dirname, name): rw = readWrite.ReadWrite(path=dirname, name=name, format='asset', t='asset') return rw.has_file()