mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge remote-tracking branch 'upstream/develop' into enhancement/tweak_logging
# Conflicts: # openpype/plugins/publish/extract_hierarchy_to_ayon.py
This commit is contained in:
commit
d36b2f1514
99 changed files with 1385 additions and 1295 deletions
35
openpype/plugins/publish/collect_farm_target.py
Normal file
35
openpype/plugins/publish/collect_farm_target.py
Normal 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")
|
||||
|
|
@ -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):
|
||||
|
|
@ -31,6 +36,44 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin):
|
|||
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.debug("All folders were filtered out")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue