Bases: ContextPlugin
Create review instance in non artist based workflow.
Called only if PS is triggered in Webpublisher or in tests.
Source code in client/ayon_photoshop/plugins/publish/collect_auto_review.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 | class CollectAutoReview(pyblish.api.ContextPlugin):
"""Create review instance in non artist based workflow.
Called only if PS is triggered in Webpublisher or in tests.
"""
label = "Collect Auto Review"
hosts = ["photoshop"]
order = pyblish.api.CollectorOrder - 0.4
targets = ["automated"]
publish = True
def process(self, context):
has_review = False
for instance in context:
if instance.data["productBaseType"] == "review":
has_review = True
creator_attributes = instance.data.get("creator_attributes", {})
if (
creator_attributes.get("mark_for_review")
and "review" not in instance.data["families"]
):
instance.data["families"].append("review")
if has_review:
self.log.debug("Review instance found, won't create new")
return
proj_settings = context.data["project_settings"]
auto_creator = proj_settings["photoshop"]["create"]["ReviewCreator"]
if not auto_creator["enabled"]:
self.log.debug("Review creator disabled, won't create new")
return
stub = photoshop.stub()
stored_items = stub.get_layers_metadata()
for item in stored_items:
if item.get("creator_identifier") == "review":
if not item.get("active"):
self.log.debug("Review instance disabled")
return
variant = (
context.data.get("variant")
or auto_creator["default_variant"]
)
project_name = context.data["projectName"]
host_name = context.data["hostName"]
folder_entity = context.data["folderEntity"]
task_entity = context.data["taskEntity"]
product_base_type = "review"
# QUESTION how to define product type for auto collector?
product_type = product_base_type
product_name = get_product_name(
project_name=project_name,
host_name=host_name,
product_base_type=product_base_type,
product_type=product_type,
variant=variant,
project_settings=proj_settings,
folder_entity=folder_entity,
task_entity=task_entity,
)
instance = context.create_instance(product_name)
instance.data.update({
"label": product_name,
"name": product_name,
"productName": product_name,
"productType": product_type,
"productBaseType": product_base_type,
"family": product_base_type,
"families": [product_base_type],
"representations": [],
"folderPath": folder_entity["path"],
"publish": self.publish
})
self.log.debug("auto review created::{}".format(instance.data))
|