mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #5695 from ynput/enhancement/OP-6451_Nuke---ExctractReviewDataMov-plugin-with-multiple-format-support
Nuke: minor docstring and code tweaks for ExtractReviewMov
This commit is contained in:
commit
2c7fc21601
2 changed files with 14 additions and 42 deletions
|
|
@ -3425,34 +3425,6 @@ def create_viewer_profile_string(viewer, display=None, path_like=False):
|
|||
return "{} ({})".format(viewer, display)
|
||||
|
||||
|
||||
def get_head_filename_without_hashes(original_path, name):
|
||||
"""Function to get the renamed head filename without frame hashes
|
||||
To avoid the system being confused on finding the filename with
|
||||
frame hashes if the head of the filename has the hashed symbol
|
||||
|
||||
Examples:
|
||||
>>> get_head_filename_without_hashes("render.####.exr", "baking")
|
||||
render.baking.####.exr
|
||||
>>> get_head_filename_without_hashes("render.%04d.exr", "tag")
|
||||
render.tag.%d.exr
|
||||
>>> get_head_filename_without_hashes("exr.####.exr", "foo")
|
||||
exr.foo.%04d.exr
|
||||
|
||||
Args:
|
||||
original_path (str): the filename with frame hashes
|
||||
name (str): the name of the tags
|
||||
|
||||
Returns:
|
||||
str: the renamed filename with the tag
|
||||
"""
|
||||
filename = os.path.basename(original_path)
|
||||
|
||||
def insert_name(matchobj):
|
||||
return "{}.{}".format(name, matchobj.group(0))
|
||||
|
||||
return re.sub(r"(%\d*d)|#+", insert_name, filename)
|
||||
|
||||
|
||||
def get_filenames_without_hash(filename, frame_start, frame_end):
|
||||
"""Get filenames without frame hash
|
||||
i.e. "renderCompositingMain.baking.0001.exr"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ from .lib import (
|
|||
get_view_process_node,
|
||||
get_viewer_config_from_string,
|
||||
deprecated,
|
||||
get_head_filename_without_hashes,
|
||||
get_filenames_without_hash
|
||||
)
|
||||
from .pipeline import (
|
||||
|
|
@ -816,19 +815,20 @@ class ExporterReviewMov(ExporterReview):
|
|||
|
||||
self.log.info("File info was set...")
|
||||
|
||||
self.file = self.fhead + self.name + ".{}".format(self.ext)
|
||||
if ".{}".format(self.ext) not in VIDEO_EXTENSIONS:
|
||||
# filename would be with frame hashes if
|
||||
# the file extension is not in video format
|
||||
filename = get_head_filename_without_hashes(
|
||||
self.path_in, self.name)
|
||||
self.file = filename
|
||||
# make sure the filename are in
|
||||
# correct image output format
|
||||
if ".{}".format(self.ext) not in self.file:
|
||||
filename_no_ext, _ = os.path.splitext(filename)
|
||||
self.file = "{}.{}".format(filename_no_ext, self.ext)
|
||||
|
||||
if ".{}".format(self.ext) in VIDEO_EXTENSIONS:
|
||||
self.file = "{}{}.{}".format(
|
||||
self.fhead, self.name, self.ext)
|
||||
else:
|
||||
# Output is image (or image sequence)
|
||||
# When the file is an image it's possible it
|
||||
# has extra information after the `fhead` that
|
||||
# we want to preserve, e.g. like frame numbers
|
||||
# or frames hashes like `####`
|
||||
filename_no_ext = os.path.splitext(
|
||||
os.path.basename(self.path_in))[0]
|
||||
after_head = filename_no_ext[len(self.fhead):]
|
||||
self.file = "{}{}.{}.{}".format(
|
||||
self.fhead, self.name, after_head, self.ext)
|
||||
self.path = os.path.join(
|
||||
self.staging_dir, self.file).replace("\\", "/")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue