Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

[QUAD] Enhancement: Add asset from Library project in placeholder #6336

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions openpype/pipeline/workfile/workfile_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
get_linked_assets,
get_representations,
)
from openpype.client.entities import get_projects
from openpype.settings import (
get_project_settings,
get_system_settings,
Expand Down Expand Up @@ -1262,6 +1263,14 @@ def get_load_plugin_options(self, options=None):
]

loader_items = list(sorted(loader_items, key=lambda i: i["label"]))
libraries_project_items = [
{
"label": "From Library : {}".format(project_name),
"value": project_name
}
for project_name in get_library_project_names()
]

options = options or {}

# Get families from all loaders excluding "*"
Expand Down Expand Up @@ -1297,6 +1306,8 @@ def get_load_plugin_options(self, options=None):
{"label": "Linked assets", "value": "linked_asset"},
{"label": "All assets", "value": "all_assets"},
]
# Add project libraries
builder_type_enum_items.extend(libraries_project_items)
build_type_label = "Asset Builder Type"
build_type_help = (
"Asset Builder Type\n"
Expand All @@ -1308,6 +1319,10 @@ def get_load_plugin_options(self, options=None):
" linked to current context asset."
"\nLinked asset are looked in database under"
" field \"inputLinks\""
"\nFrom All Assets : Template loader will look for all assets"
" in database."
"\nProject Library Assets : Template loader will look for assets"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (81 > 79 characters)

"in given project library."
)

attr_defs = [
Expand Down Expand Up @@ -2047,3 +2062,13 @@ def get_errors(self):

def create_failed(self, creator_data):
self._failed_created_publish_instances.append(creator_data)


def get_library_project_names():
libraries = list()

for project in get_projects(fields=["name", "data.library_project"]):
if project.get("data", {}).get("library_project", False):
libraries.append(project["name"])

return libraries
Loading