Skip to content

extract_workfile

ExtractWorkfile

Bases: Extractor

Extractor export DRP workfile file representation

Source code in client/ayon_resolve/plugins/publish/extract_workfile.py
 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
class ExtractWorkfile(publish.Extractor):
    """
    Extractor export DRP workfile file representation
    """

    label = "Extract Workfile"
    order = pyblish.api.ExtractorOrder
    families = ["workfile"]
    hosts = ["resolve"]

    def process(self, instance):
        project = instance.context.data["activeProject"]

        drp_file_path = instance.context.data["currentFile"]
        drp_file_name = os.path.basename(drp_file_path)

        # write out the drp workfile
        get_project_manager().ExportProject(
            project.GetName(), drp_file_path)

        # create drp workfile representation
        representation_drp = {
            'name': "drp",
            'ext': "drp",
            'files': drp_file_name,
            "stagingDir": os.path.dirname(drp_file_path),
        }
        representations = instance.data.setdefault("representations", [])
        representations.append(representation_drp)

        # add sourcePath attribute to instance
        if not instance.data.get("sourcePath"):
            instance.data["sourcePath"] = drp_file_path

        self.log.debug(
            "Added Resolve file representation: {}".format(representation_drp)
        )