mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +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)
|
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):
|
def get_filenames_without_hash(filename, frame_start, frame_end):
|
||||||
"""Get filenames without frame hash
|
"""Get filenames without frame hash
|
||||||
i.e. "renderCompositingMain.baking.0001.exr"
|
i.e. "renderCompositingMain.baking.0001.exr"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ from .lib import (
|
||||||
get_view_process_node,
|
get_view_process_node,
|
||||||
get_viewer_config_from_string,
|
get_viewer_config_from_string,
|
||||||
deprecated,
|
deprecated,
|
||||||
get_head_filename_without_hashes,
|
|
||||||
get_filenames_without_hash
|
get_filenames_without_hash
|
||||||
)
|
)
|
||||||
from .pipeline import (
|
from .pipeline import (
|
||||||
|
|
@ -816,19 +815,20 @@ class ExporterReviewMov(ExporterReview):
|
||||||
|
|
||||||
self.log.info("File info was set...")
|
self.log.info("File info was set...")
|
||||||
|
|
||||||
self.file = self.fhead + self.name + ".{}".format(self.ext)
|
if ".{}".format(self.ext) in VIDEO_EXTENSIONS:
|
||||||
if ".{}".format(self.ext) not in VIDEO_EXTENSIONS:
|
self.file = "{}{}.{}".format(
|
||||||
# filename would be with frame hashes if
|
self.fhead, self.name, self.ext)
|
||||||
# the file extension is not in video format
|
else:
|
||||||
filename = get_head_filename_without_hashes(
|
# Output is image (or image sequence)
|
||||||
self.path_in, self.name)
|
# When the file is an image it's possible it
|
||||||
self.file = filename
|
# has extra information after the `fhead` that
|
||||||
# make sure the filename are in
|
# we want to preserve, e.g. like frame numbers
|
||||||
# correct image output format
|
# or frames hashes like `####`
|
||||||
if ".{}".format(self.ext) not in self.file:
|
filename_no_ext = os.path.splitext(
|
||||||
filename_no_ext, _ = os.path.splitext(filename)
|
os.path.basename(self.path_in))[0]
|
||||||
self.file = "{}.{}".format(filename_no_ext, self.ext)
|
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.path = os.path.join(
|
||||||
self.staging_dir, self.file).replace("\\", "/")
|
self.staging_dir, self.file).replace("\\", "/")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue