def set_render_filename(self, version): """sets the render file name """ render_output_folder = os.path.join(version.absolute_path, 'Outputs').replace("\\", "/") version_string = 'v%03d' % version.version_number output_filename = render_output_folder + '/`$OS`/' + \ version.task.project.code + '_' + \ version.task.entity_type + '_' + \ str(version.task.id) + '_' + \ version.take_name + '_`$OS`_' + \ version_string + '.$F4.exr' output_filename = output_filename.replace('\\', '/') # compute a $JOB relative file path # which is much safer if the file is going to be render in multiple OSes # $HIP = the current asset path # $JOB = the current sequence path #hip = self._asset.path #hip = hou.getenv("HIP") job = hou.getenv("JOB") # eliminate environment vars while "$" in job: job = os.path.expandvars(job) job_relative_output_file_path = "$JOB/" + utils.relpath( job, output_filename, "/", "..") output_nodes = self.get_output_nodes() for output_node in output_nodes: # get only the ifd nodes for now if output_node.type().name() == 'ifd': # set the file name try: output_node.setParms( {'vm_picture': str(job_relative_output_file_path)}) except hou.PermissionError: # node is locked pass # set the compression to zips (zip, single scanline) output_node.setParms({"vm_image_exr_compression": "zips"}) # also create the folders output_file_full_path = output_node.evalParm('vm_picture') output_file_path = os.path.dirname(output_file_full_path) flat_output_file_path = output_file_path while "$" in flat_output_file_path: flat_output_file_path = os.path.expandvars( flat_output_file_path) try: os.makedirs(flat_output_file_path) except OSError: # dirs exists pass
def set_render_filename(self, version): """sets the render file name """ output_filename = \ '{version.absolute_path}/Outputs/`$OS`/' \ '{version.task.project.code}_{version.nice_name}_' \ 'v{version.version_number:03d}.$F4.exr' output_filename = \ output_filename.format(version=version).replace('\\', '/') # compute a $JOB relative file path # which is much safer if the file is going to be render in multiple OSes # $HIP = the current asset path # $JOB = the current sequence path #hip = self._asset.path #hip = hou.getenv("HIP") job = hou.getenv("JOB") # eliminate environment vars while "$" in job: job = os.path.expandvars(job) job_relative_output_file_path = \ "$JOB/%s" % utils.relpath(job, output_filename, "/", "..") output_nodes = self.get_output_nodes() for output_node in output_nodes: # get only the ifd nodes for now if output_node.type().name() == 'ifd': # set the file name try: output_node.setParms( {'vm_picture': str(job_relative_output_file_path)} ) except hou.PermissionError: # node is locked pass # set the compression to zips (zip, single scanline) output_node.setParms({"vm_image_exr_compression": "zips"}) # also create the folders output_file_full_path = output_node.evalParm('vm_picture') output_file_path = os.path.dirname(output_file_full_path) flat_output_file_path = output_file_path while "$" in flat_output_file_path: flat_output_file_path = os.path.expandvars( flat_output_file_path ) try: os.makedirs(flat_output_file_path) except OSError: # dirs exists pass
def set_render_filename(self, version): """sets the render file name """ output_filename = \ '{version.absolute_path}/Outputs/`$OS`/' \ '{version.task.project.code}_{version.nice_name}_' \ 'v{version.version_number:03d}.$F4.exr' output_filename = \ output_filename.format(version=version).replace('\\', '/') # compute a $JOB relative file path # which is much safer if the file is going to be render in multiple OSes # $HIP = the current asset path # $JOB = the current sequence path #hip = self._asset.path #hip = hou.getenv("HIP") job = hou.getenv("JOB") # eliminate environment vars while "$" in job: job = os.path.expandvars(job) from anima import utils job_relative_output_file_path = \ "$JOB/%s" % utils.relpath(job, output_filename, "/", "..") output_nodes = self.get_output_nodes() for output_node in output_nodes: # get only the ifd nodes for now if output_node.type().name() == 'ifd': # set the file name try: output_node.setParms( {'vm_picture': str(job_relative_output_file_path)}) except hou.PermissionError: # node is locked pass # set the compression to zips (zip, single scanline) output_node.setParms({"vm_image_exr_compression": "zips"}) # also create the folders output_file_full_path = output_node.evalParm('vm_picture') output_file_path = os.path.dirname(output_file_full_path) flat_output_file_path = output_file_path while "$" in flat_output_file_path: flat_output_file_path = os.path.expandvars( flat_output_file_path) try: os.makedirs(flat_output_file_path) except OSError: # dirs exists pass
def rep_path(path): return utils.relpath(self.project_directory, path, "/", "..")