mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
AYON Editorial: Hierarchy context have names as keys
This commit is contained in:
commit
f456a5ad87
5 changed files with 32 additions and 22 deletions
|
|
@ -257,8 +257,6 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
||||||
if 'shot' not in instance.data.get('family', ''):
|
if 'shot' not in instance.data.get('family', ''):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
name = instance.data["asset"]
|
|
||||||
|
|
||||||
# get handles
|
# get handles
|
||||||
handle_start = int(instance.data["handleStart"])
|
handle_start = int(instance.data["handleStart"])
|
||||||
handle_end = int(instance.data["handleEnd"])
|
handle_end = int(instance.data["handleEnd"])
|
||||||
|
|
@ -286,6 +284,8 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
||||||
parents = instance.data.get('parents', [])
|
parents = instance.data.get('parents', [])
|
||||||
self.log.debug(f"parents: {pformat(parents)}")
|
self.log.debug(f"parents: {pformat(parents)}")
|
||||||
|
|
||||||
|
# Split by '/' for AYON where asset is a path
|
||||||
|
name = instance.data["asset"].split("/")[-1]
|
||||||
actual = {name: in_info}
|
actual = {name: in_info}
|
||||||
|
|
||||||
for parent in reversed(parents):
|
for parent in reversed(parents):
|
||||||
|
|
|
||||||
|
|
@ -155,8 +155,6 @@ class CollectShotInstance(pyblish.api.InstancePlugin):
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
|
|
||||||
asset_name = instance.data["asset"]
|
|
||||||
|
|
||||||
# get handles
|
# get handles
|
||||||
handle_start = int(instance.data["handleStart"])
|
handle_start = int(instance.data["handleStart"])
|
||||||
handle_end = int(instance.data["handleEnd"])
|
handle_end = int(instance.data["handleEnd"])
|
||||||
|
|
@ -177,6 +175,8 @@ class CollectShotInstance(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
parents = instance.data.get('parents', [])
|
parents = instance.data.get('parents', [])
|
||||||
|
|
||||||
|
# Split by '/' for AYON where asset is a path
|
||||||
|
asset_name = instance.data["asset"].split("/")[-1]
|
||||||
actual = {asset_name: in_info}
|
actual = {asset_name: in_info}
|
||||||
|
|
||||||
for parent in reversed(parents):
|
for parent in reversed(parents):
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,9 @@ class CollectHierarchy(pyblish.api.ContextPlugin):
|
||||||
"resolutionHeight": instance.data["resolutionHeight"],
|
"resolutionHeight": instance.data["resolutionHeight"],
|
||||||
"pixelAspect": instance.data["pixelAspect"]
|
"pixelAspect": instance.data["pixelAspect"]
|
||||||
}
|
}
|
||||||
|
# Split by '/' for AYON where asset is a path
|
||||||
actual = {instance.data["asset"]: shot_data}
|
name = instance.data["asset"].split("/")[-1]
|
||||||
|
actual = {name: shot_data}
|
||||||
|
|
||||||
for parent in reversed(instance.data["parents"]):
|
for parent in reversed(instance.data["parents"]):
|
||||||
next_dict = {}
|
next_dict = {}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ class CollectResourcesPath(pyblish.api.InstancePlugin):
|
||||||
]
|
]
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
|
|
||||||
anatomy = instance.context.data["anatomy"]
|
anatomy = instance.context.data["anatomy"]
|
||||||
|
|
||||||
template_data = copy.deepcopy(instance.data["anatomyData"])
|
template_data = copy.deepcopy(instance.data["anatomyData"])
|
||||||
|
|
@ -80,11 +79,18 @@ class CollectResourcesPath(pyblish.api.InstancePlugin):
|
||||||
"representation": "TEMP"
|
"representation": "TEMP"
|
||||||
})
|
})
|
||||||
|
|
||||||
# For the first time publish
|
# Add fill keys for editorial publishing creating new entity
|
||||||
if instance.data.get("hierarchy"):
|
# TODO handle in editorial plugin
|
||||||
template_data.update({
|
if instance.data.get("newAssetPublishing"):
|
||||||
"hierarchy": instance.data["hierarchy"]
|
if "hierarchy" not in instance.data:
|
||||||
})
|
template_data["hierarchy"] = instance.data["hierarchy"]
|
||||||
|
|
||||||
|
if "asset" not in template_data:
|
||||||
|
asset_name = instance.data["asset"].split("/")[-1]
|
||||||
|
template_data["asset"] = asset_name
|
||||||
|
template_data["folder"] = {
|
||||||
|
"name": asset_name
|
||||||
|
}
|
||||||
|
|
||||||
publish_templates = anatomy.templates_obj["publish"]
|
publish_templates = anatomy.templates_obj["publish"]
|
||||||
if "folder" in publish_templates:
|
if "folder" in publish_templates:
|
||||||
|
|
|
||||||
|
|
@ -223,23 +223,24 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin):
|
||||||
valid_ids = set()
|
valid_ids = set()
|
||||||
|
|
||||||
hierarchy_queue = collections.deque()
|
hierarchy_queue = collections.deque()
|
||||||
hierarchy_queue.append((project_id, project_children_context))
|
hierarchy_queue.append((project_id, "", project_children_context))
|
||||||
while hierarchy_queue:
|
while hierarchy_queue:
|
||||||
queue_item = hierarchy_queue.popleft()
|
queue_item = hierarchy_queue.popleft()
|
||||||
parent_id, children_context = queue_item
|
parent_id, parent_path, children_context = queue_item
|
||||||
if not children_context:
|
if not children_context:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for asset, asset_info in children_context.items():
|
for folder_name, folder_info in children_context.items():
|
||||||
|
folder_path = "{}/{}".format(parent_path, folder_name)
|
||||||
if (
|
if (
|
||||||
asset not in active_folder_paths
|
folder_path not in active_folder_paths
|
||||||
and not asset_info.get("childs")
|
and not folder_info.get("childs")
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
asset_name = asset.split("/")[-1]
|
|
||||||
item_id = uuid.uuid4().hex
|
item_id = uuid.uuid4().hex
|
||||||
new_item = copy.deepcopy(asset_info)
|
new_item = copy.deepcopy(folder_info)
|
||||||
new_item["name"] = asset_name
|
new_item["name"] = folder_name
|
||||||
new_item["children"] = []
|
new_item["children"] = []
|
||||||
new_children_context = new_item.pop("childs", None)
|
new_children_context = new_item.pop("childs", None)
|
||||||
tasks = new_item.pop("tasks", {})
|
tasks = new_item.pop("tasks", {})
|
||||||
|
|
@ -253,9 +254,11 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin):
|
||||||
items_by_id[item_id] = new_item
|
items_by_id[item_id] = new_item
|
||||||
parent_id_by_item_id[item_id] = parent_id
|
parent_id_by_item_id[item_id] = parent_id
|
||||||
|
|
||||||
if asset in active_folder_paths:
|
if folder_path in active_folder_paths:
|
||||||
valid_ids.add(item_id)
|
valid_ids.add(item_id)
|
||||||
hierarchy_queue.append((item_id, new_children_context))
|
hierarchy_queue.append(
|
||||||
|
(item_id, folder_path, new_children_context)
|
||||||
|
)
|
||||||
|
|
||||||
if not valid_ids:
|
if not valid_ids:
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue