Skip to content

extract_review_data

ExtractReviewData

Bases: Extractor

Extracts review tag into available representation

Source code in client/ayon_nuke/plugins/publish/extract_review_data.py
 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
42
43
44
45
46
47
48
49
50
class ExtractReviewData(publish.Extractor):
    """Extracts review tag into available representation
    """

    order = pyblish.api.ExtractorOrder + 0.01
    # order = pyblish.api.CollectorOrder + 0.499
    label = "Extract Review Data"

    families = ["review"]
    hosts = ["nuke"]

    settings_category = "nuke"

    def process(self, instance):
        fpath = instance.data["path"]
        ext = os.path.splitext(fpath)[-1][1:]

        representations = instance.data.get("representations", [])

        # review can be removed since `ProcessSubmittedJobOnFarm` will create
        # reviewable representation if needed
        if (
            instance.data.get("farm")
            and "review" in instance.data["families"]
        ):
            instance.data["families"].remove("review")

        # iterate representations and add `review` tag
        for repre in representations:
            if ext != repre["ext"]:
                continue

            if not repre.get("tags"):
                repre["tags"] = []

            if "review" not in repre["tags"]:
                repre["tags"].append("review")

            self.log.debug("Matching representation: {}".format(
                pformat(repre)
            ))

        instance.data["representations"] = representations