♻️ revive linked assets/folders in template builder

Adding back linked assets/folder feature that was there in template builder in OpenPype. This is now working with template type links of AYON.
This commit is contained in:
Ondřej Samohel 2025-07-23 16:59:20 +02:00
parent 45c042cf8d
commit 55a7db7989
No known key found for this signature in database
GPG key ID: 02376E18990A97C6

View file

@ -313,7 +313,8 @@ class AbstractTemplateBuilder(ABC):
if not folder_entity:
return []
links = get_folder_links(
project_name, folder_entity["id"], link_direction="in"
project_name,
folder_entity["id"], link_types=["template"], link_direction="in"
)
linked_folder_ids = {
link["entityId"]
@ -1429,8 +1430,7 @@ class PlaceholderLoadMixin(object):
builder_type_enum_items = [
{"label": "Current folder", "value": "context_folder"},
# TODO implement linked folders
# {"label": "Linked folders", "value": "linked_folders"},
{"label": "Linked folders", "value": "linked_folders"},
{"label": "All folders", "value": "all_folders"},
]
build_type_label = "Folder Builder Type"
@ -1607,10 +1607,7 @@ class PlaceholderLoadMixin(object):
builder_type = placeholder.data["builder_type"]
folder_ids = []
if builder_type == "context_folder":
folder_ids = [current_folder_entity["id"]]
elif builder_type == "all_folders":
if builder_type == "all_folders":
folder_ids = {
folder_entity["id"]
for folder_entity in get_folders(
@ -1620,6 +1617,19 @@ class PlaceholderLoadMixin(object):
)
}
elif builder_type == "context_folder":
folder_ids = [current_folder_entity["id"]]
elif builder_type == "linked_folders":
# Get all linked folders for the current folder
if hasattr(self, "builder") and isinstance(
self.builder, AbstractTemplateBuilder):
# self.builder: AbstractTemplateBuilder
folder_ids = [
linked_folder_entity["id"]
for linked_folder_entity in self.builder.linked_folder_entities # noqa: E501
]
if not folder_ids:
return []