-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_product_info_from_ayon.py
41 lines (32 loc) · 1.05 KB
/
get_product_info_from_ayon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Get some info about a product in particular project in a particular folder path
using `product_name`, `project_name` and `folder_path`
"""
import ayon_api
from ayon_core.pipeline import get_current_context
product_name = "pointcacheBgeoCache"
# Get Current Context
context = get_current_context()
project_name = context["project_name"]
folder_path = context["folder_path"]
folder_entity = ayon_api.get_folder_by_path(project_name, folder_path)
product_entities = ayon_api.get_products(
project_name,
folder_ids={folder_entity["id"]},
product_name_regex=product_name,
fields={"id", "name", "productType"}
)
for product_entity in product_entities:
print("product_entity: ", product_entity)
version_entity = ayon_api.get_last_version_by_product_name(
project_name,
product_name,
folder_entity["id"]
)
representations = ayon_api.get_representations(
project_name,
version_ids={version_entity["id"]},
fields={"id", "name", "files.path"}
)
for representation in representations:
print("representation:", representation)