Merge branch 'develop' into enhancement/OP-5265_Use-custom-staging-dir-function-for-Maya-renders

This commit is contained in:
Toke Stuart Jepsen 2023-09-01 09:27:26 +01:00
commit 2f0533fc2d
86 changed files with 1996 additions and 479 deletions

View file

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
import pyblish.api
class CollectFarmTarget(pyblish.api.InstancePlugin):
"""Collects the render target for the instance
"""
order = pyblish.api.CollectorOrder + 0.499
label = "Collect Farm Target"
targets = ["local"]
def process(self, instance):
if not instance.data.get("farm"):
return
context = instance.context
farm_name = ""
op_modules = context.data.get("openPypeModules")
for farm_renderer in ["deadline", "royalrender", "muster"]:
op_module = op_modules.get(farm_renderer, False)
if op_module and op_module.enabled:
farm_name = farm_renderer
elif not op_module:
self.log.error("Cannot get OpenPype {0} module.".format(
farm_renderer))
if farm_name:
self.log.debug("Collected render target: {0}".format(farm_name))
instance.data["toBeRenderedOn"] = farm_name
else:
AssertionError("No OpenPype renderer module found")

View file

@ -53,8 +53,8 @@ class ExtractBurnin(publish.Extractor):
"flame",
"houdini",
"max",
"blender"
# "resolve"
"blender",
"unreal"
]
optional = True

View file

@ -8,6 +8,11 @@ from ayon_api import slugify_string
from ayon_api.entity_hub import EntityHub
from openpype import AYON_SERVER_ENABLED
from openpype.client import get_assets
from openpype.pipeline.template_data import (
get_asset_template_data,
get_task_template_data,
)
def _default_json_parse(value):
@ -27,13 +32,51 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin):
hierarchy_context = context.data.get("hierarchyContext")
if not hierarchy_context:
self.log.info("Skipping")
self.log.debug("Skipping")
return
project_name = context.data["projectName"]
self._create_hierarchy(context, project_name)
self._fill_instance_entities(context, project_name)
def _fill_instance_entities(self, context, project_name):
instances_by_asset_name = collections.defaultdict(list)
for instance in context:
if instance.data.get("publish") is False:
continue
instance_entity = instance.data.get("assetEntity")
if instance_entity:
continue
# Skip if instance asset does not match
instance_asset_name = instance.data.get("asset")
instances_by_asset_name[instance_asset_name].append(instance)
project_doc = context.data["projectEntity"]
asset_docs = get_assets(
project_name, asset_names=instances_by_asset_name.keys()
)
asset_docs_by_name = {
asset_doc["name"]: asset_doc
for asset_doc in asset_docs
}
for asset_name, instances in instances_by_asset_name.items():
asset_doc = asset_docs_by_name[asset_name]
asset_data = get_asset_template_data(asset_doc, project_name)
for instance in instances:
task_name = instance.data.get("task")
template_data = get_task_template_data(
project_doc, asset_doc, task_name)
template_data.update(copy.deepcopy(asset_data))
instance.data["anatomyData"].update(template_data)
instance.data["assetEntity"] = asset_doc
def _create_hierarchy(self, context, project_name):
hierarchy_context = self._filter_hierarchy(context)
if not hierarchy_context:
self.log.info("All folders were filtered out")
self.log.debug("All folders were filtered out")
return
self.log.debug("Hierarchy_context: {}".format(

View file

@ -128,7 +128,7 @@ class ExtractThumbnailFromSource(pyblish.api.InstancePlugin):
if thumbnail_created:
return full_output_path
self.log.warning("Thumbanil has not been created.")
self.log.warning("Thumbnail has not been created.")
def _instance_has_thumbnail(self, instance):
if "representations" not in instance.data:
@ -147,6 +147,7 @@ class ExtractThumbnailFromSource(pyblish.api.InstancePlugin):
oiio_cmd = get_oiio_tool_args(
"oiiotool",
"-a", src_path,
"--ch", "R,G,B",
"-o", dst_path
)
self.log.info("Running: {}".format(" ".join(oiio_cmd)))

View file

@ -7,12 +7,12 @@ from openpype.pipeline.publish import (
class ValidatePublishDir(pyblish.api.InstancePlugin):
"""Validates if 'publishDir' is a project directory
"""Validates if files are being published into a project directory
'publishDir' is collected based on publish templates. In specific cases
('source' template) source folder of items is used as a 'publishDir', this
validates if it is inside any project dir for the project.
(eg. files are not published from local folder, unaccessible for studio'
In specific cases ('source' template - in place publishing) source folder
of published items is used as a regular `publish` dir.
This validates if it is inside any project dir for the project.
(eg. files are not published from local folder, inaccessible for studio')
"""
@ -44,6 +44,8 @@ class ValidatePublishDir(pyblish.api.InstancePlugin):
anatomy = instance.context.data["anatomy"]
# original_dirname must be convertable to rootless path
# in other case it is path inside of root folder for the project
success, _ = anatomy.find_root_template_from_path(original_dirname)
formatting_data = {
@ -56,11 +58,12 @@ class ValidatePublishDir(pyblish.api.InstancePlugin):
formatting_data=formatting_data)
def _get_template_name_from_instance(self, instance):
"""Find template which will be used during integration."""
project_name = instance.context.data["projectName"]
host_name = instance.context.data["hostName"]
anatomy_data = instance.data["anatomyData"]
family = anatomy_data["family"]
family = self.family_mapping.get("family") or family
family = self.family_mapping.get(family) or family
task_info = anatomy_data.get("task") or {}
return get_publish_template_name(

View file

@ -25,16 +25,16 @@ class ValidateVersion(pyblish.api.InstancePlugin):
# TODO: Remove full non-html version upon drop of old publisher
msg = (
"Version '{0}' from instance '{1}' that you are "
" trying to publish is lower or equal to an existing version "
" in the database. Version in database: '{2}'."
"trying to publish is lower or equal to an existing version "
"in the database. Version in database: '{2}'."
"Please version up your workfile to a higher version number "
"than: '{2}'."
).format(version, instance.data["name"], latest_version)
msg_html = (
"Version <b>{0}</b> from instance <b>{1}</b> that you are "
" trying to publish is lower or equal to an existing version "
" in the database. Version in database: <b>{2}</b>.<br><br>"
"trying to publish is lower or equal to an existing version "
"in the database. Version in database: <b>{2}</b>.<br><br>"
"Please version up your workfile to a higher version number "
"than: <b>{2}</b>."
).format(version, instance.data["name"], latest_version)