Skip to content

OTIOExportTask

OTIOExportPreset

Bases: TaskPresetBase

Source code in client/ayon_hiero/api/startup/Python/Startup/otioexporter/OTIOExportTask.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class OTIOExportPreset(hiero.core.TaskPresetBase):
    def __init__(self, name, properties):
        """Initialise presets to default values"""
        hiero.core.TaskPresetBase.__init__(self, OTIOExportTask, name)

        self.properties()["includeTags"] = hiero_export.include_tags = True
        self.properties().update(properties)

    def supportedItems(self):
        return hiero.core.TaskPresetBase.kSequence

    def addCustomResolveEntries(self, resolver):
        resolver.addResolver(
            "{ext}",
            "Extension of the file to be output",
            lambda keyword, task: "otio"
        )

    def supportsAudio(self):
        return True

__init__(name, properties)

Initialise presets to default values

Source code in client/ayon_hiero/api/startup/Python/Startup/otioexporter/OTIOExportTask.py
58
59
60
61
62
63
def __init__(self, name, properties):
    """Initialise presets to default values"""
    hiero.core.TaskPresetBase.__init__(self, OTIOExportTask, name)

    self.properties()["includeTags"] = hiero_export.include_tags = True
    self.properties().update(properties)

OTIOExportTask

Bases: TaskBase

Source code in client/ayon_hiero/api/startup/Python/Startup/otioexporter/OTIOExportTask.py
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
51
52
53
54
class OTIOExportTask(hiero.core.TaskBase):

    def __init__(self, initDict):
        """Initialize"""
        hiero.core.TaskBase.__init__(self, initDict)
        self.otio_timeline = None

    def name(self):
        return str(type(self))

    def startTask(self):
        self.otio_timeline = hiero_export.create_otio_timeline()

    def taskStep(self):
        return False

    def finishTask(self):
        try:
            exportPath = self.resolvedExportPath()

            # Check file extension
            if not exportPath.lower().endswith(".otio"):
                exportPath += ".otio"

            # check export root exists
            dirname = os.path.dirname(exportPath)
            util.filesystem.makeDirs(dirname)

            # write otio file
            hiero_export.write_to_file(self.otio_timeline, exportPath)

        # Catch all exceptions and log error
        except Exception as e:
            self.setError("failed to write file {f}\n{e}".format(
                f=exportPath,
                e=e)
            )

        hiero.core.TaskBase.finishTask(self)

    def forcedAbort(self):
        pass

__init__(initDict)

Initialize

Source code in client/ayon_hiero/api/startup/Python/Startup/otioexporter/OTIOExportTask.py
15
16
17
18
def __init__(self, initDict):
    """Initialize"""
    hiero.core.TaskBase.__init__(self, initDict)
    self.otio_timeline = None