def export_GRP(grp_name, file): if grp_name in get_all_nodes(): node = pynode(grp_name) node.savefile(file) return 1 else: logger.warning( 'Please create a node named "{}" with all the things you wants to export' .format(grp_name)) return 0
def export_node(file, node_name, asset): if node_name in get_all_nodes(): node = pynode(node_name) if type(node).__name__ == defaults._guerilla_node_type_: node.savefile(file) save() wall.wall().publish_event(asset) else: logger.warning('Node "{}" is missing'.format(node_name)) else: logger.warning('Node "{}" is missing'.format(node_name))
def seq(mode='farm', file_ext='exr', qual=-1): # Get file name / path and job path render_path, job_path = get_paths() # Versionning versions = os.listdir(render_path) if not versions: os.mkdir(render_path + '/V000') else: filevalue = versions[-1] indexing = filevalue.split('V') indexing = int(indexing[-1]) indexing += 1 indexing = padding_numbers.padder(indexing, pad) filevalue = 'V' + str(indexing) os.mkdir(render_path + '/' + filevalue) last_version = os.listdir(render_path) last_version = last_version[-1] render_path = render_path + '/' + last_version out_image_vars = 'out' + '$n_.$04f.$x' out_image_name = render_path + '/' + out_image_vars quality_settings = var_render + quality[qual] rPass = None rPass = li.get_Rpass() prefs = pynode('Preferences') with Modifier() as mod: prefs.RenderfarmSequence.set(quality_settings) rPass.FileName.set(out_image_name) rPass.DisplayDriver.set(file_ext) # Render the images opts = dict({'JobsDirectory': job_path}) guerilla.render(mode, opts)
def exrId(path, filename): ''' Transforms the Id pass into an exrid pass. This function also creates a folder Returns the final path for the exrId. Syntax : exrId(path=<render_path>, filename=<name_of_your_render_file>) example : new_path = exrId(path='D:\\Renders',filename='$o_ID.$f.x$') print(new_path) This prints ===> 'D:/Renders/exrid/$o_ID.$f.x$' ''' rLayer = pynode('RenderPass|Layer') with Modifier() as mod: id_aov = None for aov in rLayer.children(): if aov.PlugName.get() == 'Id': print('ID pass found.') id_pass = aov.PlugName.get() id_aov = aov else: raise ValueError('No Id Pass found.') if id_aov: id_aov.OverrideSettings.set(True) id_aov.FileName.set(aov_path) id_aov.DisplayDriver.set('exrid') path += '\\exrid' if os.path.exists(path): if len(os.listdir(path)) > 0: raise ValueError( 'This folder already exists and has objects in it.') print('The folder already exists but is empty.') else: os.mkdir(path) aov_path = path + '\\' + filename return aov_path
asset_path = asset_path.split(';') asset_type = asset_path[-1] asset_path = asset_path[0] asset_name = asset_path.split('/') asset_name = asset_name[-1] asset_name, asset_ext = ext.get_ext(asset_name) write_path = project_dir + '/prod/assets/' + asset_type + '/' + asset_name + '/lookdev/guerilla/' a = dict({'prefixnodes':False,'containschildren':False}) rPass = pynode('RenderPass') # add a reference with Modifier() as mod: refNode, topNodes = mod.createref(asset_name + '__ref', asset_path, parent=None, options=a) refNode.setinheritedattr('Referenceable',False, False) refNode, topNodes = mod.createref('cyclo', cyclo_dir, parent=None, options=a) refNode.setinheritedattr('Referenceable',False, False) # create the plug using createplug # createplug throws an exception if the plug already exists, so try/except is recommended try: mod.createplug (rPass, 'Referenceable', plugType='Plug', dataType='bool', flags=guerilla.Plug.Dynamic)
seq_path = seq_path.split(';') ref_list = [seq_path[2]] last_frame = seq_path[1] seq_path = seq_path[0] seq_name = seq_path.split('/') seq_name = seq_name[-2] write_path = project_dir + '/prod/seq/' + seq_name + '/lookdev/guerilla/' a = dict({'prefixnodes':False,'containschildren':False}) doc.LastFrame.set(int(last_frame)) rPass = pynode('RenderPass') # add a reference with Modifier() as mod: refNode, topNodes = mod.createref('chars__ref', seq_path + '/chars.abc', parent=None, options=a) refNode, topNodes = mod.createref('props__ref', seq_path + '/props.abc', parent=None, options=a) refNode, topNodes = mod.createref('sets__ref', seq_path + '/sets.abc', parent=None, options=a) refNode, topNodes = mod.createref('cams__ref', seq_path + '/cams.abc', parent=None, options=a) refNode, topNodes = mod.createref('building__ref', seq_path + '/building.abc', parent=None, options=a) refNode.setinheritedattr('Referenceable',False, False) # create the plug using createplug # createplug throws an exception if the plug already exists, so try/except is recommended
def launch_new(mode='farm', file_ext='png', qual='LD_', local=False, frames=None, exrid=True): ''' ''' # Get file name / path and job path render_path, render_local_path, job_path = get_paths() #passer en mode hyperespace rPass = None rPass = li.get_Rpass() prefs = pynode('Preferences') # Versionning day, hour = format_time() folder = day + '_' + hour + '.' + mode.lower() render_path = render_path + '/' + folder os.system('setx IMAGES ' + render_path) out_image_vars = 'out' + '_$n_$04f.$x' try: os.mkdir(render_path) if exrid == True: #aov_path = exrId(render_path, out_image_vars) pass except: raise Exception('ARRETE TOI') out_image_name = render_path + '/' + out_image_vars out_pass_name = '$o' with Modifier() as mod: rPass.FileName.set(out_image_name) quality_settings = var_render + qual with Modifier() as mod: prefs.RenderfarmSequence.set(quality_settings) rPass.FileName.set(out_image_name) rPass.FileLayerName.set(out_pass_name) rPass.DisplayDriver.set(file_ext) # Job Path => temporary ? job_path = render_path + '/' + 'jobs' os.mkdir(job_path) if frames: opts = dict({ 'JobsDirectory': job_path, 'RibsDirectory': job_path, 'Frames': frames }) else: opts = dict({'JobsDirectory': job_path, 'RibsDirectory': job_path}) # Render the images guerilla.render(mode, opts) # revenir en mode local out_image_name = render_local_path + '/' + out_image_vars with Modifier() as mod: rPass.FileName.set(out_image_name)
def asset(mode='farm', file_ext='png', qual=1, local=False): ''' ''' # Get file name / path and job path render_path, render_local_path, job_path = get_paths() #passer en mode hyperespace rPass = None rPass = li.get_Rpass() prefs = pynode('Preferences') # Versionning versions = os.listdir(render_path) if 'local' in versions: versions.remove('local') if not versions: os.mkdir(render_path + '/V000') else: filevalue = versions[-1] indexing = filevalue.split('V') indexing = int(indexing[-1]) indexing += 1 indexing = padding_numbers.padder(indexing, pad) filevalue = 'V' + str(indexing) os.mkdir(render_path + '/' + filevalue) last_version = os.listdir(render_path) last_version = last_version[-1] render_path = render_path + '/' + last_version out_image_vars = 'out' + '_.$04f.$x' out_image_name = render_path + '/' + out_image_vars with Modifier() as mod: rPass.FileName.set(out_image_name) quality_settings = var_render + quality[qual] with Modifier() as mod: prefs.RenderfarmSequence.set(quality_settings) rPass.FileName.set(out_image_name) rPass.DisplayDriver.set(file_ext) # Job Path => temporary ? job_path = render_path + '/' + 'jobs' os.mkdir(job_path) opts = dict({'JobsDirectory': job_path}) # Render the images print('render place : ' + out_image_name) print('render jobs : ' + job_path) guerilla.render(mode, opts) # revenir en mode local out_image_name = render_local_path + '/' + out_image_vars print('new render place : ' + out_image_name) with Modifier() as mod: rPass.FileName.set(out_image_name)