Skip to content

extract_otio_file

ExtractOTIOFile

Bases: Extractor

Extractor export OTIO file

Source code in client/ayon_flame/plugins/publish/extract_otio_file.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
class ExtractOTIOFile(publish.Extractor):
    """
    Extractor export OTIO file
    """

    label = "Extract OTIO file"
    order = pyblish.api.ExtractorOrder - 0.45
    families = ["workfile"]
    hosts = ["flame"]

    def process(self, instance):
        # create representation data
        if "representations" not in instance.data:
            instance.data["representations"] = []

        name = instance.data["name"]
        staging_dir = self.staging_dir(instance)

        otio_timeline = instance.context.data["otioTimeline"]
        # create otio timeline representation
        otio_file_name = name + ".otio"
        otio_file_path = os.path.join(staging_dir, otio_file_name)

        # export otio file to temp dir
        otio.adapters.write_to_file(otio_timeline, otio_file_path)

        representation_otio = {
            'name': "otio",
            'ext': "otio",
            'files': otio_file_name,
            "stagingDir": staging_dir,
        }

        instance.data["representations"].append(representation_otio)

        self.log.info("Added OTIO file representation: {}".format(
            representation_otio))