mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Global: implementing burnin profiles linking to extract review
This commit is contained in:
parent
4989091050
commit
28e28db6c7
3 changed files with 63 additions and 9 deletions
|
|
@ -110,6 +110,9 @@ class ExtractBurnin(openpype.api.Extractor):
|
|||
).format(host_name, family, task_name))
|
||||
return
|
||||
|
||||
self.log.debug("profile: {}".format(
|
||||
profile))
|
||||
|
||||
# Pre-filter burnin definitions by instance families
|
||||
burnin_defs = self.filter_burnins_defs(profile, instance)
|
||||
if not burnin_defs:
|
||||
|
|
@ -126,18 +129,44 @@ class ExtractBurnin(openpype.api.Extractor):
|
|||
|
||||
anatomy = instance.context.data["anatomy"]
|
||||
scriptpath = self.burnin_script_path()
|
||||
|
||||
# Executable args that will execute the script
|
||||
# [pype executable, *pype script, "run"]
|
||||
executable_args = get_pype_execute_args("run", scriptpath)
|
||||
|
||||
from pprint import pformat
|
||||
self.log.debug(pformat(instance.data["representations"]))
|
||||
|
||||
for idx, repre in enumerate(tuple(instance.data["representations"])):
|
||||
self.log.debug("repre ({}): `{}`".format(idx + 1, repre["name"]))
|
||||
|
||||
repre_burnin_links = repre.get("burnins", [])
|
||||
|
||||
if not self.repres_is_valid(repre):
|
||||
continue
|
||||
|
||||
self.log.debug("repre_burnin_links: {}".format(
|
||||
repre_burnin_links))
|
||||
|
||||
self.log.debug("burnin_defs.keys(): {}".format(
|
||||
burnin_defs.keys()))
|
||||
|
||||
# Filter output definition by `burnin` represetation key
|
||||
repre_linked_burnins = {
|
||||
name: output for name, output in burnin_defs.items()
|
||||
if name in repre_burnin_links
|
||||
}
|
||||
self.log.debug("repre_linked_burnins: {}".format(
|
||||
repre_linked_burnins))
|
||||
|
||||
# if any match then replace burnin defs and follow tag filtering
|
||||
_burnin_defs = copy.deepcopy(burnin_defs)
|
||||
if repre_linked_burnins:
|
||||
_burnin_defs = repre_linked_burnins
|
||||
|
||||
# Filter output definition by representation tags (optional)
|
||||
repre_burnin_defs = self.filter_burnins_by_tags(
|
||||
burnin_defs, repre["tags"]
|
||||
_burnin_defs, repre["tags"]
|
||||
)
|
||||
if not repre_burnin_defs:
|
||||
self.log.info((
|
||||
|
|
@ -281,14 +310,16 @@ class ExtractBurnin(openpype.api.Extractor):
|
|||
# NOTE we maybe can keep source representation if necessary
|
||||
instance.data["representations"].remove(repre)
|
||||
|
||||
# Delete input files
|
||||
for filepath in files_to_delete:
|
||||
if os.path.exists(filepath):
|
||||
os.remove(filepath)
|
||||
self.log.debug("Removed: \"{}\"".format(filepath))
|
||||
self.log.debug("Files to delete: {}".format(files_to_delete))
|
||||
|
||||
if do_decompress and os.path.exists(decompressed_dir):
|
||||
shutil.rmtree(decompressed_dir)
|
||||
# Delete input files
|
||||
for filepath in files_to_delete:
|
||||
if os.path.exists(filepath):
|
||||
os.remove(filepath)
|
||||
self.log.debug("Removed: \"{}\"".format(filepath))
|
||||
|
||||
if do_decompress and os.path.exists(decompressed_dir):
|
||||
shutil.rmtree(decompressed_dir)
|
||||
|
||||
def _get_burnin_options(self):
|
||||
# Prepare burnin options
|
||||
|
|
|
|||
|
|
@ -180,6 +180,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
if "tags" not in output_def:
|
||||
output_def["tags"] = []
|
||||
|
||||
if "burnins" not in output_def:
|
||||
output_def["burnins"] = []
|
||||
|
||||
# Create copy of representation
|
||||
new_repre = copy.deepcopy(repre)
|
||||
|
||||
|
|
@ -192,6 +195,17 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
if tag not in new_repre["tags"]:
|
||||
new_repre["tags"].append(tag)
|
||||
|
||||
# Add burnin link from output definition to representation
|
||||
for burnin in output_def["burnins"]:
|
||||
if burnin not in new_repre.get("burnins", []):
|
||||
if not new_repre.get("burnins"):
|
||||
new_repre["burnins"] = []
|
||||
new_repre["burnins"].append(str(burnin))
|
||||
|
||||
self.log.debug(
|
||||
"Linked burnins: `{}`".format(new_repre["burnins"])
|
||||
)
|
||||
|
||||
self.log.debug(
|
||||
"New representation tags: `{}`".format(new_repre["tags"])
|
||||
)
|
||||
|
|
@ -232,7 +246,10 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
for f in files_to_clean:
|
||||
os.unlink(f)
|
||||
|
||||
output_name = output_def["filename_suffix"]
|
||||
output_name = new_repre.get("outputName", "")
|
||||
if output_name:
|
||||
output_name += "_"
|
||||
output_name += output_def["filename_suffix"]
|
||||
if temp_data["without_handles"]:
|
||||
output_name += "_noHandles"
|
||||
|
||||
|
|
|
|||
|
|
@ -198,6 +198,12 @@
|
|||
"type": "schema",
|
||||
"name": "schema_representation_tags"
|
||||
},
|
||||
{
|
||||
"key": "burnins",
|
||||
"label": "Link to a burnin by name",
|
||||
"type": "list",
|
||||
"object_type": "text"
|
||||
},
|
||||
{
|
||||
"key": "ffmpeg_args",
|
||||
"label": "FFmpeg arguments",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue