mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'develop' into maya_new_publisher
# Conflicts: # openpype/hosts/maya/api/lib.py # openpype/plugins/publish/collect_scene_version.py
This commit is contained in:
commit
9e9a9bd5e6
277 changed files with 5336 additions and 7574 deletions
|
|
@ -19,12 +19,13 @@ class OpenInDJV(load.LoaderPlugin):
|
|||
|
||||
djv_list = existing_djv_path()
|
||||
families = ["*"] if djv_list else []
|
||||
representations = [
|
||||
representations = ["*"]
|
||||
extensions = {
|
||||
"cin", "dpx", "avi", "dv", "gif", "flv", "mkv", "mov", "mpg", "mpeg",
|
||||
"mp4", "m4v", "mxf", "iff", "z", "ifl", "jpeg", "jpg", "jfif", "lut",
|
||||
"1dl", "exr", "pic", "png", "ppm", "pnm", "pgm", "pbm", "rla", "rpf",
|
||||
"sgi", "rgba", "rgb", "bw", "tga", "tiff", "tif", "img", "h264",
|
||||
]
|
||||
}
|
||||
|
||||
label = "Open in DJV"
|
||||
order = -10
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ class CleanUp(pyblish.api.InstancePlugin):
|
|||
staging_dir = instance.data.get("stagingDir", None)
|
||||
|
||||
if not staging_dir:
|
||||
self.log.info("Staging dir not set.")
|
||||
self.log.debug("Skipping cleanup. Staging dir not set "
|
||||
"on instance: {}.".format(instance))
|
||||
return
|
||||
|
||||
if not os.path.normpath(staging_dir).startswith(temp_root):
|
||||
|
|
@ -90,7 +91,7 @@ class CleanUp(pyblish.api.InstancePlugin):
|
|||
return
|
||||
|
||||
if not os.path.exists(staging_dir):
|
||||
self.log.info("No staging directory found: %s" % staging_dir)
|
||||
self.log.debug("No staging directory found at: %s" % staging_dir)
|
||||
return
|
||||
|
||||
if instance.data.get("stagingDir_persistent"):
|
||||
|
|
@ -131,7 +132,9 @@ class CleanUp(pyblish.api.InstancePlugin):
|
|||
try:
|
||||
os.remove(src)
|
||||
except PermissionError:
|
||||
self.log.warning("Insufficient permission to delete {}".format(src))
|
||||
self.log.warning(
|
||||
"Insufficient permission to delete {}".format(src)
|
||||
)
|
||||
continue
|
||||
|
||||
# add dir for cleanup
|
||||
|
|
|
|||
|
|
@ -67,5 +67,6 @@ class CollectAnatomyContextData(pyblish.api.ContextPlugin):
|
|||
# Store
|
||||
context.data["anatomyData"] = anatomy_data
|
||||
|
||||
self.log.info("Global anatomy Data collected")
|
||||
self.log.debug(json.dumps(anatomy_data, indent=4))
|
||||
self.log.debug("Global Anatomy Context Data collected:\n{}".format(
|
||||
json.dumps(anatomy_data, indent=4)
|
||||
))
|
||||
|
|
|
|||
|
|
@ -46,17 +46,17 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
|
|||
follow_workfile_version = False
|
||||
|
||||
def process(self, context):
|
||||
self.log.info("Collecting anatomy data for all instances.")
|
||||
self.log.debug("Collecting anatomy data for all instances.")
|
||||
|
||||
project_name = context.data["projectName"]
|
||||
self.fill_missing_asset_docs(context, project_name)
|
||||
self.fill_latest_versions(context, project_name)
|
||||
self.fill_anatomy_data(context)
|
||||
|
||||
self.log.info("Anatomy Data collection finished.")
|
||||
self.log.debug("Anatomy Data collection finished.")
|
||||
|
||||
def fill_missing_asset_docs(self, context, project_name):
|
||||
self.log.debug("Qeurying asset documents for instances.")
|
||||
self.log.debug("Querying asset documents for instances.")
|
||||
|
||||
context_asset_doc = context.data.get("assetEntity")
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
|
|||
instance_name = instance.data["name"]
|
||||
instance_label = instance.data.get("label")
|
||||
if instance_label:
|
||||
instance_name += "({})".format(instance_label)
|
||||
instance_name += " ({})".format(instance_label)
|
||||
self.log.debug("Anatomy data for instance {}: {}".format(
|
||||
instance_name,
|
||||
json.dumps(anatomy_data, indent=4)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ class CollectAnatomyObject(pyblish.api.ContextPlugin):
|
|||
|
||||
context.data["anatomy"] = Anatomy(project_name)
|
||||
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"Anatomy object collected for project \"{}\".".format(project_name)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -65,6 +65,6 @@ class CollectCustomStagingDir(pyblish.api.InstancePlugin):
|
|||
else:
|
||||
result_str = "Not adding"
|
||||
|
||||
self.log.info("{} custom staging dir for instance with '{}'".format(
|
||||
self.log.debug("{} custom staging dir for instance with '{}'".format(
|
||||
result_str, family
|
||||
))
|
||||
|
|
|
|||
|
|
@ -92,5 +92,5 @@ class CollectFromCreateContext(pyblish.api.ContextPlugin):
|
|||
|
||||
instance.data["transientData"] = transient_data
|
||||
|
||||
self.log.info("collected instance: {}".format(instance.data))
|
||||
self.log.info("parsing data: {}".format(in_data))
|
||||
self.log.debug("collected instance: {}".format(instance.data))
|
||||
self.log.debug("parsing data: {}".format(in_data))
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import json
|
|||
import pyblish.api
|
||||
|
||||
from openpype.pipeline import legacy_io, KnownPublishError
|
||||
from openpype.pipeline.publish.lib import add_repre_files_for_cleanup
|
||||
|
||||
|
||||
class CollectRenderedFiles(pyblish.api.ContextPlugin):
|
||||
|
|
@ -89,6 +90,7 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
|
|||
|
||||
# now we can just add instances from json file and we are done
|
||||
for instance_data in data.get("instances"):
|
||||
|
||||
self.log.info(" - processing instance for {}".format(
|
||||
instance_data.get("subset")))
|
||||
instance = self._context.create_instance(
|
||||
|
|
@ -107,6 +109,8 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
|
|||
self._fill_staging_dir(repre_data, anatomy)
|
||||
representations.append(repre_data)
|
||||
|
||||
add_repre_files_for_cleanup(instance, repre_data)
|
||||
|
||||
instance.data["representations"] = representations
|
||||
|
||||
# add audio if in metadata data
|
||||
|
|
@ -157,6 +161,8 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
|
|||
os.environ.update(session_data)
|
||||
session_is_set = True
|
||||
self._process_path(data, anatomy)
|
||||
context.data["cleanupFullPaths"].append(path)
|
||||
context.data["cleanupEmptyDirs"].append(os.path.dirname(path))
|
||||
except Exception as e:
|
||||
self.log.error(e, exc_info=True)
|
||||
raise Exception("Error") from e
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ class CollectSceneVersion(pyblish.api.ContextPlugin):
|
|||
if '<shell>' in filename:
|
||||
return
|
||||
|
||||
self.log.debug(
|
||||
"Collecting scene version from filename: {}".format(filename)
|
||||
)
|
||||
|
||||
version = get_version_from_path(filename)
|
||||
if version is None:
|
||||
raise KnownPublishError("Unable to retrieve version number from "
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ from openpype.lib import (
|
|||
should_convert_for_ffmpeg
|
||||
)
|
||||
from openpype.lib.profiles_filtering import filter_profiles
|
||||
from openpype.pipeline.publish.lib import add_repre_files_for_cleanup
|
||||
|
||||
|
||||
class ExtractBurnin(publish.Extractor):
|
||||
|
|
@ -353,6 +354,8 @@ class ExtractBurnin(publish.Extractor):
|
|||
# Add new representation to instance
|
||||
instance.data["representations"].append(new_repre)
|
||||
|
||||
add_repre_files_for_cleanup(instance, new_repre)
|
||||
|
||||
# Cleanup temp staging dir after procesisng of output definitions
|
||||
if do_convert:
|
||||
temp_dir = repre["stagingDir"]
|
||||
|
|
@ -517,8 +520,8 @@ class ExtractBurnin(publish.Extractor):
|
|||
"""
|
||||
|
||||
if "burnin" not in (repre.get("tags") or []):
|
||||
self.log.info((
|
||||
"Representation \"{}\" don't have \"burnin\" tag. Skipped."
|
||||
self.log.debug((
|
||||
"Representation \"{}\" does not have \"burnin\" tag. Skipped."
|
||||
).format(repre["name"]))
|
||||
return False
|
||||
|
||||
|
|
|
|||
|
|
@ -336,13 +336,13 @@ class ExtractOIIOTranscode(publish.Extractor):
|
|||
|
||||
if repre.get("ext") not in self.supported_exts:
|
||||
self.log.debug((
|
||||
"Representation '{}' of unsupported extension. Skipped."
|
||||
).format(repre["name"]))
|
||||
"Representation '{}' has unsupported extension: '{}'. Skipped."
|
||||
).format(repre["name"], repre.get("ext")))
|
||||
return False
|
||||
|
||||
if not repre.get("files"):
|
||||
self.log.debug((
|
||||
"Representation '{}' have empty files. Skipped."
|
||||
"Representation '{}' has empty files. Skipped."
|
||||
).format(repre["name"]))
|
||||
return False
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@ from openpype.lib.transcoding import (
|
|||
convert_input_paths_for_ffmpeg,
|
||||
get_transcode_temp_directory,
|
||||
)
|
||||
from openpype.pipeline.publish import KnownPublishError
|
||||
from openpype.pipeline.publish import (
|
||||
KnownPublishError,
|
||||
get_publish_instance_label,
|
||||
)
|
||||
from openpype.pipeline.publish.lib import add_repre_files_for_cleanup
|
||||
|
||||
|
||||
class ExtractReview(pyblish.api.InstancePlugin):
|
||||
|
|
@ -92,8 +96,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
host_name = instance.context.data["hostName"]
|
||||
family = self.main_family_from_instance(instance)
|
||||
|
||||
self.log.info("Host: \"{}\"".format(host_name))
|
||||
self.log.info("Family: \"{}\"".format(family))
|
||||
self.log.debug("Host: \"{}\"".format(host_name))
|
||||
self.log.debug("Family: \"{}\"".format(family))
|
||||
|
||||
profile = filter_profiles(
|
||||
self.profiles,
|
||||
|
|
@ -202,17 +206,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
|
||||
return filtered_defs
|
||||
|
||||
@staticmethod
|
||||
def get_instance_label(instance):
|
||||
return (
|
||||
getattr(instance, "label", None)
|
||||
or instance.data.get("label")
|
||||
or instance.data.get("name")
|
||||
or str(instance)
|
||||
)
|
||||
|
||||
def main_process(self, instance):
|
||||
instance_label = self.get_instance_label(instance)
|
||||
instance_label = get_publish_instance_label(instance)
|
||||
self.log.debug("Processing instance \"{}\"".format(instance_label))
|
||||
profile_outputs = self._get_outputs_for_instance(instance)
|
||||
if not profile_outputs:
|
||||
|
|
@ -351,7 +346,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
temp_data = self.prepare_temp_data(instance, repre, output_def)
|
||||
files_to_clean = []
|
||||
if temp_data["input_is_sequence"]:
|
||||
self.log.info("Filling gaps in sequence.")
|
||||
self.log.debug("Checking sequence to fill gaps in sequence..")
|
||||
files_to_clean = self.fill_sequence_gaps(
|
||||
files=temp_data["origin_repre"]["files"],
|
||||
staging_dir=new_repre["stagingDir"],
|
||||
|
|
@ -425,6 +420,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
)
|
||||
instance.data["representations"].append(new_repre)
|
||||
|
||||
add_repre_files_for_cleanup(instance, new_repre)
|
||||
|
||||
def input_is_sequence(self, repre):
|
||||
"""Deduce from representation data if input is sequence."""
|
||||
# TODO GLOBAL ISSUE - Find better way how to find out if input
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
).format(subset_name))
|
||||
return
|
||||
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"Processing instance with subset name {}".format(subset_name)
|
||||
)
|
||||
|
||||
|
|
@ -89,13 +89,13 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
|
||||
src_staging = os.path.normpath(repre["stagingDir"])
|
||||
full_input_path = os.path.join(src_staging, input_file)
|
||||
self.log.info("input {}".format(full_input_path))
|
||||
self.log.debug("input {}".format(full_input_path))
|
||||
filename = os.path.splitext(input_file)[0]
|
||||
jpeg_file = filename + "_thumb.jpg"
|
||||
full_output_path = os.path.join(dst_staging, jpeg_file)
|
||||
|
||||
if oiio_supported:
|
||||
self.log.info("Trying to convert with OIIO")
|
||||
self.log.debug("Trying to convert with OIIO")
|
||||
# If the input can read by OIIO then use OIIO method for
|
||||
# conversion otherwise use ffmpeg
|
||||
thumbnail_created = self.create_thumbnail_oiio(
|
||||
|
|
@ -148,7 +148,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
|
||||
def _already_has_thumbnail(self, repres):
|
||||
for repre in repres:
|
||||
self.log.info("repre {}".format(repre))
|
||||
self.log.debug("repre {}".format(repre))
|
||||
if repre["name"] == "thumbnail":
|
||||
return True
|
||||
return False
|
||||
|
|
@ -173,20 +173,20 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
return filtered_repres
|
||||
|
||||
def create_thumbnail_oiio(self, src_path, dst_path):
|
||||
self.log.info("outputting {}".format(dst_path))
|
||||
self.log.info("Extracting thumbnail {}".format(dst_path))
|
||||
oiio_tool_path = get_oiio_tools_path()
|
||||
oiio_cmd = [
|
||||
oiio_tool_path,
|
||||
"-a", src_path,
|
||||
"-o", dst_path
|
||||
]
|
||||
self.log.info("running: {}".format(" ".join(oiio_cmd)))
|
||||
self.log.debug("running: {}".format(" ".join(oiio_cmd)))
|
||||
try:
|
||||
run_subprocess(oiio_cmd, logger=self.log)
|
||||
return True
|
||||
except Exception:
|
||||
self.log.warning(
|
||||
"Failed to create thubmnail using oiiotool",
|
||||
"Failed to create thumbnail using oiiotool",
|
||||
exc_info=True
|
||||
)
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class ExtractThumbnailFromSource(pyblish.api.InstancePlugin):
|
|||
self._create_context_thumbnail(instance.context)
|
||||
|
||||
subset_name = instance.data["subset"]
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"Processing instance with subset name {}".format(subset_name)
|
||||
)
|
||||
thumbnail_source = instance.data.get("thumbnailSource")
|
||||
|
|
@ -104,7 +104,7 @@ class ExtractThumbnailFromSource(pyblish.api.InstancePlugin):
|
|||
full_output_path = os.path.join(dst_staging, dst_filename)
|
||||
|
||||
if oiio_supported:
|
||||
self.log.info("Trying to convert with OIIO")
|
||||
self.log.debug("Trying to convert with OIIO")
|
||||
# If the input can read by OIIO then use OIIO method for
|
||||
# conversion otherwise use ffmpeg
|
||||
thumbnail_created = self.create_thumbnail_oiio(
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
|
||||
instance_stagingdir = instance.data.get("stagingDir")
|
||||
if not instance_stagingdir:
|
||||
self.log.info((
|
||||
self.log.debug((
|
||||
"{0} is missing reference to staging directory."
|
||||
" Will try to get it from representation."
|
||||
).format(instance))
|
||||
|
|
@ -480,7 +480,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
update_data
|
||||
)
|
||||
|
||||
self.log.info("Prepared subset: {}".format(subset_name))
|
||||
self.log.debug("Prepared subset: {}".format(subset_name))
|
||||
return subset_doc
|
||||
|
||||
def prepare_version(self, instance, op_session, subset_doc, project_name):
|
||||
|
|
@ -521,7 +521,9 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
project_name, version_doc["type"], version_doc
|
||||
)
|
||||
|
||||
self.log.info("Prepared version: v{0:03d}".format(version_doc["name"]))
|
||||
self.log.debug(
|
||||
"Prepared version: v{0:03d}".format(version_doc["name"])
|
||||
)
|
||||
|
||||
return version_doc
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,9 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
|
||||
def process(self, instance):
|
||||
if instance.data.get("processedWithNewIntegrator"):
|
||||
self.log.info("Instance was already processed with new integrator")
|
||||
self.log.debug(
|
||||
"Instance was already processed with new integrator"
|
||||
)
|
||||
return
|
||||
|
||||
for ef in self.exclude_families:
|
||||
|
|
@ -274,7 +276,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
|
||||
stagingdir = instance.data.get("stagingDir")
|
||||
if not stagingdir:
|
||||
self.log.info((
|
||||
self.log.debug((
|
||||
"{0} is missing reference to staging directory."
|
||||
" Will try to get it from representation."
|
||||
).format(instance))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import pyblish.api
|
|||
|
||||
from openpype.client import get_versions
|
||||
from openpype.client.operations import OperationsSession, new_thumbnail_doc
|
||||
from openpype.pipeline.publish import get_publish_instance_label
|
||||
|
||||
InstanceFilterResult = collections.namedtuple(
|
||||
"InstanceFilterResult",
|
||||
|
|
@ -41,7 +42,7 @@ class IntegrateThumbnails(pyblish.api.ContextPlugin):
|
|||
# Filter instances which can be used for integration
|
||||
filtered_instance_items = self._prepare_instances(context)
|
||||
if not filtered_instance_items:
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"All instances were filtered. Thumbnail integration skipped."
|
||||
)
|
||||
return
|
||||
|
|
@ -133,7 +134,7 @@ class IntegrateThumbnails(pyblish.api.ContextPlugin):
|
|||
|
||||
filtered_instances = []
|
||||
for instance in context:
|
||||
instance_label = self._get_instance_label(instance)
|
||||
instance_label = get_publish_instance_label(instance)
|
||||
# Skip instances without published representations
|
||||
# - there is no place where to put the thumbnail
|
||||
published_repres = instance.data.get("published_representations")
|
||||
|
|
@ -162,7 +163,7 @@ class IntegrateThumbnails(pyblish.api.ContextPlugin):
|
|||
|
||||
# Skip instance if thumbnail path is not available for it
|
||||
if not thumbnail_path:
|
||||
self.log.info((
|
||||
self.log.debug((
|
||||
"Skipping thumbnail integration for instance \"{}\"."
|
||||
" Instance and context"
|
||||
" thumbnail paths are not available."
|
||||
|
|
@ -248,7 +249,7 @@ class IntegrateThumbnails(pyblish.api.ContextPlugin):
|
|||
|
||||
for instance_item in filtered_instance_items:
|
||||
instance, thumbnail_path, version_id = instance_item
|
||||
instance_label = self._get_instance_label(instance)
|
||||
instance_label = get_publish_instance_label(instance)
|
||||
version_doc = version_docs_by_str_id.get(version_id)
|
||||
if not version_doc:
|
||||
self.log.warning((
|
||||
|
|
@ -339,10 +340,3 @@ class IntegrateThumbnails(pyblish.api.ContextPlugin):
|
|||
))
|
||||
|
||||
op_session.commit()
|
||||
|
||||
def _get_instance_label(self, instance):
|
||||
return (
|
||||
instance.data.get("label")
|
||||
or instance.data.get("name")
|
||||
or "N/A"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue