mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge pull request #3580 from pypeclub/bugfix/integrate_fails_editorial_publish
Editorial publishing workflow improvements
This commit is contained in:
commit
fc3b0e4741
7 changed files with 67 additions and 14 deletions
|
|
@ -136,7 +136,8 @@ class CollectTimelineInstances(pyblish.api.ContextPlugin):
|
|||
"tasks": {
|
||||
task["name"]: {"type": task["type"]}
|
||||
for task in self.add_tasks},
|
||||
"representations": []
|
||||
"representations": [],
|
||||
"newAssetPublishing": True
|
||||
})
|
||||
self.log.debug("__ inst_data: {}".format(pformat(inst_data)))
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
|
|||
"clipAnnotations": annotations,
|
||||
|
||||
# add all additional tags
|
||||
"tags": phiero.get_track_item_tags(track_item)
|
||||
"tags": phiero.get_track_item_tags(track_item),
|
||||
"newAssetPublishing": True
|
||||
})
|
||||
|
||||
# otio clip data
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
|
|||
"publish": resolve.get_publish_attribute(timeline_item),
|
||||
"fps": context.data["fps"],
|
||||
"handleStart": handle_start,
|
||||
"handleEnd": handle_end
|
||||
"handleEnd": handle_end,
|
||||
"newAssetPublishing": True
|
||||
})
|
||||
|
||||
# otio clip data
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ class CollectInstances(pyblish.api.InstancePlugin):
|
|||
"frameStart": frame_start,
|
||||
"frameEnd": frame_end,
|
||||
"frameStartH": frame_start - handle_start,
|
||||
"frameEndH": frame_end + handle_end
|
||||
"frameEndH": frame_end + handle_end,
|
||||
"newAssetPublishing": True
|
||||
}
|
||||
|
||||
for data_key in instance_data_filter:
|
||||
|
|
|
|||
|
|
@ -30,9 +30,15 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
self.log.debug("__ hierarchy_context: {}".format(hierarchy_context))
|
||||
|
||||
self.project = None
|
||||
self.import_to_avalon(project_name, hierarchy_context)
|
||||
self.import_to_avalon(context, project_name, hierarchy_context)
|
||||
|
||||
def import_to_avalon(self, project_name, input_data, parent=None):
|
||||
def import_to_avalon(
|
||||
self,
|
||||
context,
|
||||
project_name,
|
||||
input_data,
|
||||
parent=None,
|
||||
):
|
||||
for name in input_data:
|
||||
self.log.info("input_data[name]: {}".format(input_data[name]))
|
||||
entity_data = input_data[name]
|
||||
|
|
@ -127,12 +133,19 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
if unarchive_entity is None:
|
||||
# Create entity if doesn"t exist
|
||||
entity = self.create_avalon_asset(
|
||||
project_name, name, data
|
||||
name, data
|
||||
)
|
||||
else:
|
||||
# Unarchive if entity was archived
|
||||
entity = self.unarchive_entity(unarchive_entity, data)
|
||||
|
||||
# make sure all relative instances have correct avalon data
|
||||
self._set_avalon_data_to_relative_instances(
|
||||
context,
|
||||
project_name,
|
||||
entity
|
||||
)
|
||||
|
||||
if update_data:
|
||||
# Update entity data with input data
|
||||
legacy_io.update_many(
|
||||
|
|
@ -142,7 +155,7 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
|
||||
if "childs" in entity_data:
|
||||
self.import_to_avalon(
|
||||
project_name, entity_data["childs"], entity
|
||||
context, project_name, entity_data["childs"], entity
|
||||
)
|
||||
|
||||
def unarchive_entity(self, entity, data):
|
||||
|
|
@ -159,20 +172,52 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
|
|||
{"_id": entity["_id"]},
|
||||
new_entity
|
||||
)
|
||||
|
||||
return new_entity
|
||||
|
||||
def create_avalon_asset(self, project_name, name, data):
|
||||
item = {
|
||||
def create_avalon_asset(self, name, data):
|
||||
asset_doc = {
|
||||
"schema": "openpype:asset-3.0",
|
||||
"name": name,
|
||||
"parent": self.project["_id"],
|
||||
"type": "asset",
|
||||
"data": data
|
||||
}
|
||||
self.log.debug("Creating asset: {}".format(item))
|
||||
entity_id = legacy_io.insert_one(item).inserted_id
|
||||
self.log.debug("Creating asset: {}".format(asset_doc))
|
||||
asset_doc["_id"] = legacy_io.insert_one(asset_doc).inserted_id
|
||||
|
||||
return get_asset_by_id(project_name, entity_id)
|
||||
return asset_doc
|
||||
|
||||
def _set_avalon_data_to_relative_instances(
|
||||
self,
|
||||
context,
|
||||
project_name,
|
||||
asset_doc
|
||||
):
|
||||
for instance in context:
|
||||
# Skip instance if has filled asset entity
|
||||
if instance.data.get("assetEntity"):
|
||||
continue
|
||||
asset_name = asset_doc["name"]
|
||||
inst_asset_name = instance.data["asset"]
|
||||
|
||||
if asset_name == inst_asset_name:
|
||||
instance.data["assetEntity"] = asset_doc
|
||||
|
||||
# get parenting data
|
||||
parents = asset_doc["data"].get("parents") or list()
|
||||
|
||||
# equire only relative parent
|
||||
parent_name = project_name
|
||||
if parents:
|
||||
parent_name = parents[-1]
|
||||
|
||||
# update avalon data on instance
|
||||
instance.data["anatomyData"].update({
|
||||
"hierarchy": "/".join(parents),
|
||||
"task": {},
|
||||
"parent": parent_name
|
||||
})
|
||||
|
||||
def _get_active_assets(self, context):
|
||||
""" Returns only asset dictionary.
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
"".format(len(prepared_representations)))
|
||||
|
||||
def prepare_subset(self, instance, project_name):
|
||||
asset_doc = instance.data.get("assetEntity")
|
||||
asset_doc = instance.data["assetEntity"]
|
||||
subset_name = instance.data["subset"]
|
||||
self.log.debug("Subset: {}".format(subset_name))
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ class ValidateAssetDocs(pyblish.api.InstancePlugin):
|
|||
if instance.data.get("assetEntity"):
|
||||
self.log.info("Instance has set asset document in its data.")
|
||||
|
||||
elif instance.data.get("newAssetPublishing"):
|
||||
# skip if it is editorial
|
||||
self.log.info("Editorial instance is no need to check...")
|
||||
|
||||
else:
|
||||
raise PublishValidationError((
|
||||
"Instance \"{}\" doesn't have asset document "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue