def validate_project(project_item): '''Make sure the project does not already exist.''' if os.path.exists(project_item['path']): raise Abort('Project already exists: %s' % project_item['path']) return True
def validate_collection(collection_item): '''Make sure new collection does not exist''' if os.path.exists(collection_item['path']): raise Abort('collection already exists: ' + collection_item['name']) return True
def save_next_workfile(ctx, publish_items): '''Save the next workfile.''' host = get_host() scene = publish_items['scene'] # Get the next version number for the original scene name if ctx.workspace: next_version = ctx.workspace.get_next_version( scene['scene_data']['name'], scene['scene_data']['ext'], ) else: next_version = int(scene['scene_data']['version']) + 1 # Construct the next scene_file path next_scene_name = scene['scene_file'].replace( scene['scene_data']['version'], '{:0>3d}'.format(next_version), ) next_scene_file = utils.unipath(scene['scene_root'], next_scene_name) # If the path already exists Abort... if os.path.isfile(next_scene_file): raise Abort('Next scene file already exists. Reopening workfile.') # Copy the original scene file to the next version shutil.copy2(scene['scene_file'], next_scene_file) return next_scene_file
def validate_scene(publish_items): '''Validate the scene file.''' # Ensure publish scene does not exist scene = publish_items['scene'] if os.path.isfile(scene['publish_file']): raise Abort('Publish file already exists: %s' % os.path.basename(scene['publish_file']))
def validate_task(task_item): '''Validate potential task''' if os.path.exists(task_item['path']): raise Abort('Task already exists: ' + task_item['name']) return True
def validate_workspace(workspace_item): '''Validate potential workspace''' if os.path.exists(workspace_item['path']): raise Abort('Task already exists: ' + workspace_item['name']) return True
def validate_shot(shot_item): '''Make sure shot does not exist''' if os.path.exists(shot_item['path']): raise Abort('Shot already exists: ' + shot_item['name']) return True
def validate_sequence(sequence_item): '''Make sure new sequence does not exist.''' if os.path.exists(sequence_item['path']): raise Abort('Sequence already exists: ' + sequence_item['name']) return True
def validate_asset_type(asset_type): '''Make sure new asset_type does not already exist''' if asset_type.exists: raise Abort('Asset Type already exists: %s' % asset_type.name) return True
def validate_asset(asset_item): '''Make sure new asset does not exist''' if os.path.exists(asset_item['path']): raise Abort('Asset already exists: ' + asset_item['name']) return True
def validate_template(template): '''Make sure template does not already exist''' if (os.path.exists(template.path) or template.name in construct.get_templates()): raise Abort('Template already exists: ' + template.name)