Skip to content

collect_movie_batch

CollectMovieBatch

Bases: InstancePlugin, AYONPyblishPluginMixin

Collect file url for batch movies and create representation.

Adds review on instance and to repre.tags based on value of toggle button on creator.

Source code in client/ayon_traypublisher/plugins/publish/collect_movie_batch.py
 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
42
43
44
45
46
47
48
class CollectMovieBatch(
    pyblish.api.InstancePlugin, AYONPyblishPluginMixin
):
    """Collect file url for batch movies and create representation.

    Adds review on instance and to repre.tags based on value of toggle button
    on creator.
    """

    label = "Collect Movie Batch Files"
    order = pyblish.api.CollectorOrder

    hosts = ["traypublisher"]

    def process(self, instance):
        if instance.data.get("creator_identifier") != "render_movie_batch":
            return

        creator_attributes = instance.data["creator_attributes"]

        file_url = creator_attributes["filepath"]
        file_name = os.path.basename(file_url)
        _, ext = os.path.splitext(file_name)

        repre = {
            "name": ext[1:],
            "ext": ext[1:],
            "files": file_name,
            "stagingDir": os.path.dirname(file_url),
            "tags": []
        }
        instance.data["representations"].append(repre)

        if creator_attributes["add_review_family"]:
            repre["tags"].append("review")
            instance.data["families"].append("review")
            if not instance.data.get("thumbnailSource"):
                instance.data["thumbnailSource"] = file_url

        instance.data["source"] = file_url

        self.log.debug("instance.data {}".format(instance.data))