Merge branch 'hotfix/celaction-standalone'

This commit is contained in:
Milan Kolar 2020-08-12 14:20:50 +02:00
commit f72432ee2e
8 changed files with 102 additions and 41 deletions

View file

@ -107,7 +107,7 @@ class CelactionPrelaunchHook(PypeHook):
f"--asset {asset}",
f"--task {task}",
"--currentFile \\\"\"*SCENE*\"\\\"",
"--chunk *CHUNK*",
"--chunk 10",
"--frameStart *START*",
"--frameEnd *END*",
"--resolutionWidth *X*",

View file

@ -110,7 +110,9 @@ def _subprocess(*args, **kwargs):
log.error(line)
if proc.returncode != 0:
raise ValueError("\"{}\" was not successful: {}".format(args, output))
raise ValueError(
"\"{}\" was not successful:\nOutput: {}\nError: {}".format(
args, output, error))
return output

View file

@ -16,7 +16,7 @@ class AppendCelactionAudio(pyblish.api.ContextPlugin):
# get all available representations
subsets = pype.get_subsets(asset_entity["name"],
representations=["audio"]
representations=["audio", "wav"]
)
self.log.info(f"subsets is: {pformat(subsets)}")

View file

@ -52,7 +52,7 @@ class CollectCelactionInstances(pyblish.api.ContextPlugin):
"subset": subset,
"label": scene_file,
"family": family,
"families": [family],
"families": [family, "ftrack"],
"representations": list()
})

View file

@ -141,6 +141,8 @@ class ExtractCelactionDeadline(pyblish.api.InstancePlugin):
# # Asset dependency to wait for at least the scene file to sync.
# "AssetDependency0": script_path
"ScheduledType": "Once",
"JobDelay": "00:00:08:00"
},
"PluginInfo": {
# Input

View file

@ -1,29 +1,7 @@
import os
import shutil
import pyblish.api
def clean_renders(instance):
transfers = instance.data.get("transfers", list())
current_families = instance.data.get("families", list())
instance_family = instance.data.get("family", None)
dirnames = []
for src, dest in transfers:
if os.path.normpath(src) != os.path.normpath(dest):
if instance_family == 'render' or 'render' in current_families:
os.remove(src)
dirnames.append(os.path.dirname(src))
# make unique set
cleanup_dirs = set(dirnames)
for dir in cleanup_dirs:
try:
os.rmdir(dir)
except OSError:
# directory is not empty, skipping
continue
import re
class CleanUp(pyblish.api.InstancePlugin):
@ -39,6 +17,9 @@ class CleanUp(pyblish.api.InstancePlugin):
optional = True
active = True
# Presets
paterns = None # list of regex paterns
def process(self, instance):
# Get the errored instances
failed = []
@ -52,8 +33,8 @@ class CleanUp(pyblish.api.InstancePlugin):
)
)
self.log.info("Cleaning renders ...")
clean_renders(instance)
self.log.info("Cleaning renders new...")
self.clean_renders(instance)
if [ef for ef in self.exclude_families
if instance.data["family"] in ef]:
@ -73,3 +54,74 @@ class CleanUp(pyblish.api.InstancePlugin):
self.log.info("Removing staging directory ...")
shutil.rmtree(staging_dir)
def clean_renders(self, instance):
transfers = instance.data.get("transfers", list())
current_families = instance.data.get("families", list())
instance_family = instance.data.get("family", None)
dirnames = []
transfers_dirs = []
for src, dest in transfers:
# fix path inconsistency
src = os.path.normpath(src)
dest = os.path.normpath(dest)
# add src dir into clearing dir paths (regex paterns)
transfers_dirs.append(os.path.dirname(src))
# add dest dir into clearing dir paths (regex paterns)
transfers_dirs.append(os.path.dirname(dest))
if os.path.normpath(src) != os.path.normpath(dest):
if instance_family == 'render' or 'render' in current_families:
self.log.info("Removing src: `{}`...".format(src))
os.remove(src)
# add dir for cleanup
dirnames.append(os.path.dirname(src))
# clean by regex paterns
# make unique set
transfers_dirs = set(transfers_dirs)
self.log.debug("__ transfers_dirs: `{}`".format(transfers_dirs))
self.log.debug("__ self.paterns: `{}`".format(self.paterns))
if self.paterns:
files = list()
# get list of all available content of dirs
for _dir in transfers_dirs:
if not os.path.exists(_dir):
continue
files.extend([
os.path.join(_dir, f)
for f in os.listdir(_dir)])
self.log.debug("__ files: `{}`".format(files))
# remove all files which match regex patern
for f in files:
for p in self.paterns:
patern = re.compile(p)
if not patern.findall(f):
continue
if not os.path.exists(f):
continue
self.log.info("Removing file by regex: `{}`".format(f))
os.remove(f)
# add dir for cleanup
dirnames.append(os.path.dirname(f))
# make unique set
cleanup_dirs = set(dirnames)
# clean dirs which are empty
for dir in cleanup_dirs:
try:
os.rmdir(dir)
except OSError:
# directory is not empty, skipping
continue

View file

@ -119,6 +119,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
if "review" not in tags or "thumbnail" in tags:
continue
if "passing" in tags:
continue
input_ext = repre["ext"]
if input_ext.startswith("."):
input_ext = input_ext[1:]
@ -1314,7 +1317,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
output_args.extend(profile.get('output', []))
# defining image ratios
resolution_ratio = (float(resolution_width) * pixel_aspect) / resolution_height
resolution_ratio = (
float(resolution_width) * pixel_aspect) / resolution_height
delivery_ratio = float(self.to_width) / float(self.to_height)
self.log.debug(
"__ resolution_ratio: `{}`".format(resolution_ratio))
@ -1371,7 +1375,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
output_args.append("-shortest")
if no_handles:
duration_sec = float(frame_end_handle - frame_start_handle + 1) / fps
duration_sec = float(
frame_end_handle - frame_start_handle + 1) / fps
output_args.append("-t {:0.2f}".format(duration_sec))
@ -1393,7 +1398,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
self.log.debug("lower then delivery")
width_scale = int(self.to_width * scale_factor)
width_half_pad = int((
self.to_width - width_scale)/2)
self.to_width - width_scale) / 2)
height_scale = self.to_height
height_half_pad = 0
else:
@ -1408,7 +1413,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
height_scale = int(
resolution_height * scale_factor)
height_half_pad = int(
(self.to_height - height_scale)/2)
(self.to_height - height_scale) / 2)
self.log.debug(
"__ width_scale: `{}`".format(width_scale))
@ -1425,11 +1430,11 @@ class ExtractReview(pyblish.api.InstancePlugin):
scaling_arg = str(
"scale={0}x{1}:flags=lanczos,"
"pad={2}:{3}:{4}:{5}:black,setsar=1"
).format(width_scale, height_scale,
self.to_width, self.to_height,
width_half_pad,
height_half_pad
)
).format(width_scale, height_scale,
self.to_width, self.to_height,
width_half_pad,
height_half_pad
)
vf_back = self.add_video_filter_args(
output_args, scaling_arg)
@ -1449,7 +1454,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
lut_arg = "lut3d=file='{}'".format(
lut_path.replace(
"\\", "/").replace(":/", "\\:/")
)
)
lut_arg += ",colormatrix=bt601:bt709"
vf_back = self.add_video_filter_args(
@ -1504,7 +1509,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
"outputName": name + "_noHandles",
"frameStartFtrack": frame_start,
"frameEndFtrack": frame_end
})
})
if repre_new.get('preview'):
repre_new.pop("preview")
if repre_new.get('thumbnail'):

View file

@ -53,7 +53,7 @@ class CollectClipRepresentations(pyblish.api.InstancePlugin):
"fps": fps,
"name": json_repr_subset,
"ext": json_repr_ext,
"tags": ["review", "delete"]
"tags": ["review", "passing", "ftrackreview"]
}
else:
representation = {