mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
roy's comment and make sure fps for preview animation in thumbnail extractor is the same as preview animation
This commit is contained in:
parent
41dd7e06f9
commit
9fd1321cb9
2 changed files with 20 additions and 63 deletions
|
|
@ -15,7 +15,6 @@ class ExtractReviewAnimation(publish.Extractor):
|
|||
families = ["review"]
|
||||
|
||||
def process(self, instance):
|
||||
self.log.info("Extracting Review Animation ...")
|
||||
staging_dir = self.staging_dir(instance)
|
||||
ext = instance.data.get("imageFormat")
|
||||
filename = "{0}..{1}".format(instance.name, ext)
|
||||
|
|
@ -27,7 +26,7 @@ class ExtractReviewAnimation(publish.Extractor):
|
|||
filenames = self.get_files(
|
||||
instance.name, start, end, ext)
|
||||
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"Writing Review Animation to"
|
||||
" '%s' to '%s'" % (filename, staging_dir))
|
||||
|
||||
|
|
@ -39,7 +38,7 @@ class ExtractReviewAnimation(publish.Extractor):
|
|||
if not instance.data.get("keepImages"):
|
||||
tags.append("delete")
|
||||
|
||||
self.log.info("Performing Extraction ...")
|
||||
self.log.debug("Performing Extraction ...")
|
||||
|
||||
representation = {
|
||||
"name": instance.data["imageFormat"],
|
||||
|
|
@ -89,6 +88,6 @@ class ExtractReviewAnimation(publish.Extractor):
|
|||
if enabled:
|
||||
job_args.append(f"{key}:{enabled}")
|
||||
job_str = " ".join(job_args)
|
||||
self.log.info(f"{job_str}")
|
||||
self.log.debug(job_str)
|
||||
|
||||
return job_str
|
||||
|
|
|
|||
|
|
@ -16,26 +16,25 @@ class ExtractThumbnail(publish.Extractor):
|
|||
families = ["review"]
|
||||
|
||||
def process(self, instance):
|
||||
self.log.info("Extracting Thumbnail ...")
|
||||
|
||||
# TODO: Create temp directory for thumbnail
|
||||
# - this is to avoid "override" of source file
|
||||
tmp_staging = tempfile.mkdtemp(prefix="pyblish_tmp_")
|
||||
self.log.debug(
|
||||
f"Create temp directory {tmp_staging} for thumbnail"
|
||||
)
|
||||
fps = int(instance.data["fps"])
|
||||
instance.context.data["cleanupFullPaths"].append(tmp_staging)
|
||||
filename = "{name}..jpg".format(**instance.data)
|
||||
filename = "{name}_thumbnail..jpg".format(**instance.data)
|
||||
filepath = os.path.join(tmp_staging, filename)
|
||||
filepath = filepath.replace("\\", "/")
|
||||
thumbnail = self.get_filename(instance.name)
|
||||
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"Writing Thumbnail to"
|
||||
" '%s' to '%s'" % (filename, tmp_staging))
|
||||
|
||||
preview_arg = self.set_preview_arg(
|
||||
instance, filepath)
|
||||
instance, filepath, fps)
|
||||
rt.execute(preview_arg)
|
||||
|
||||
representation = {
|
||||
|
|
@ -53,70 +52,29 @@ class ExtractThumbnail(publish.Extractor):
|
|||
instance.data["representations"].append(representation)
|
||||
|
||||
def get_filename(self, filename):
|
||||
return f"{filename}.0001.jpg"
|
||||
return f"{filename}_thumbnail.0001.jpg"
|
||||
|
||||
def set_preview_arg(self, instance, filepath):
|
||||
def set_preview_arg(self, instance, filepath, fps):
|
||||
job_args = list()
|
||||
default_option = f'CreatePreview filename:"{filepath}"'
|
||||
job_args.append(default_option)
|
||||
|
||||
frame_option = f"outputAVI:false start:1 end:1" # noqa
|
||||
frame_option = f"outputAVI:false start:1 end:1 fps:{fps}" # noqa
|
||||
job_args.append(frame_option)
|
||||
rndLevel = instance.data.get("rndLevel")
|
||||
if rndLevel:
|
||||
option = f"rndLevel:#{rndLevel}"
|
||||
job_args.append(option)
|
||||
percentSize = instance.data.get("percentSize")
|
||||
if percentSize:
|
||||
size = int(percentSize)
|
||||
option = f"percentSize:{size}"
|
||||
job_args.append(option)
|
||||
dspGeometry = instance.data.get("dspGeometry")
|
||||
if dspGeometry:
|
||||
option = f"dspGeometry:{dspGeometry}"
|
||||
job_args.append(option)
|
||||
dspShapes = instance.data.get("dspShapes")
|
||||
if dspShapes:
|
||||
option = f"dspShapes:{dspShapes}"
|
||||
job_args.append(option)
|
||||
dspLights = instance.data.get("dspLights")
|
||||
if dspLights:
|
||||
option = f"dspShapes:{dspLights}"
|
||||
job_args.append(option)
|
||||
dspCameras = instance.data.get("dspCameras")
|
||||
if dspCameras:
|
||||
option = f"dspCameras:{dspCameras}"
|
||||
job_args.append(option)
|
||||
dspHelpers = instance.data.get("dspHelpers")
|
||||
if dspHelpers:
|
||||
option = f"dspHelpers:{dspHelpers}"
|
||||
job_args.append(option)
|
||||
dspParticles = instance.data.get("dspParticles")
|
||||
if dspParticles:
|
||||
option = f"dspParticles:{dspParticles}"
|
||||
job_args.append(option)
|
||||
dspBones = instance.data.get("dspBones")
|
||||
if dspBones:
|
||||
option = f"dspBones:{dspBones}"
|
||||
job_args.append(option)
|
||||
dspBkg = instance.data.get("dspBkg")
|
||||
if dspBkg:
|
||||
option = f"dspBkg:{dspBkg}"
|
||||
job_args.append(option)
|
||||
dspGrid = instance.data.get("dspGrid")
|
||||
if dspGrid:
|
||||
option = f"dspBkg:{dspBkg}"
|
||||
job_args.append(option)
|
||||
dspSafeFrame = instance.data.get("dspSafeFrame")
|
||||
if dspSafeFrame:
|
||||
option = f"dspSafeFrame:{dspSafeFrame}"
|
||||
job_args.append(option)
|
||||
dspFrameNums = instance.data.get("dspFrameNums")
|
||||
if dspFrameNums:
|
||||
option = f"dspFrameNums:{dspFrameNums}"
|
||||
job_args.append(option)
|
||||
options = [
|
||||
"percentSize", "dspGeometry", "dspShapes",
|
||||
"dspLights", "dspCameras", "dspHelpers", "dspParticles",
|
||||
"dspBones", "dspBkg", "dspGrid", "dspSafeFrame", "dspFrameNums"
|
||||
]
|
||||
|
||||
for key in options:
|
||||
enabled = instance.data.get(key)
|
||||
if enabled:
|
||||
job_args.append(f"{key}:{enabled}")
|
||||
job_str = " ".join(job_args)
|
||||
self.log.info(f"{job_str}")
|
||||
self.log.debug(job_str)
|
||||
|
||||
return job_str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue