Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Add folder type and path to template data #445

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions client/ayon_core/pipeline/template_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def get_folder_template_data(folder_entity, project_name):
- 'parent' - direct parent name, project name used if is under
project

Required document fields:
Folder: 'path' -> Plan to require: 'folderType'
Required entity fields:
Folder: 'path', 'folderType'

Args:
folder_entity (Dict[str, Any]): Folder entity.
Expand All @@ -101,6 +101,8 @@ def get_folder_template_data(folder_entity, project_name):
return {
"folder": {
"name": folder_name,
iLLiCiTiT marked this conversation as resolved.
Show resolved Hide resolved
"type": folder_entity["folderType"],
"path": path,
},
"asset": folder_name,
"hierarchy": hierarchy,
Expand Down
29 changes: 11 additions & 18 deletions client/ayon_core/plugins/publish/collect_anatomy_instance_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import pyblish.api
import ayon_api

from ayon_core.pipeline.template_data import get_folder_template_data
from ayon_core.pipeline.version_start import get_versioning_start


Expand Down Expand Up @@ -383,24 +384,11 @@ def _fill_folder_data(self, instance, project_entity, anatomy_data):
# - 'folder', 'hierarchy', 'parent', 'folder'
folder_entity = instance.data.get("folderEntity")
if folder_entity:
folder_name = folder_entity["name"]
folder_path = folder_entity["path"]
hierarchy_parts = folder_path.split("/")
hierarchy_parts.pop(0)
hierarchy_parts.pop(-1)
parent_name = project_entity["name"]
if hierarchy_parts:
parent_name = hierarchy_parts[-1]

hierarchy = "/".join(hierarchy_parts)
anatomy_data.update({
"asset": folder_name,
"hierarchy": hierarchy,
"parent": parent_name,
"folder": {
"name": folder_name,
},
})
folder_data = get_folder_template_data(
folder_entity,
project_entity["name"]
)
anatomy_data.update(folder_data)
return

if instance.data.get("newAssetPublishing"):
Expand All @@ -418,6 +406,11 @@ def _fill_folder_data(self, instance, project_entity, anatomy_data):
"parent": parent_name,
"folder": {
"name": folder_name,
"path": instance.data["folderPath"],
# TODO get folder type from hierarchy
# Using 'Shot' is current default behavior of editorial
# (or 'newAssetPublishing') publishing.
"type": "Shot",
},
})

Expand Down