Skip to content

collect_editorial_instances

CollectEditorialInstance

Bases: InstancePlugin

Collect data for instances created by settings creators.

Source code in client/ayon_traypublisher/plugins/publish/collect_editorial_instances.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
class CollectEditorialInstance(pyblish.api.InstancePlugin):
    """Collect data for instances created by settings creators."""

    label = "Collect Editorial Instances"
    order = pyblish.api.CollectorOrder - 0.1

    hosts = ["traypublisher"]
    families = ["editorial"]

    def process(self, instance):

        if "families" not in instance.data:
            instance.data["families"] = []

        if "representations" not in instance.data:
            instance.data["representations"] = []

        fpath = instance.data["sequenceFilePath"]
        otio_timeline_string = instance.data.pop("otioTimeline")
        otio_timeline = otio.adapters.read_from_string(
            otio_timeline_string)

        instance.context.data["otioTimeline"] = otio_timeline

        self.log.info(fpath)

        instance.data["stagingDir"] = os.path.dirname(fpath)

        _, ext = os.path.splitext(fpath)

        instance.data["representations"].append({
            "ext": ext[1:],
            "name": ext[1:],
            "stagingDir": instance.data["stagingDir"],
            "files": os.path.basename(fpath)
        })

        self.log.debug("Created Editorial Instance {}".format(
            pformat(instance.data)
        ))