Skip to content

collect_workfile

Requires

None

Provides

instance.data["representations"] -> workfile representation

CollectWorkfile

Bases: ContextPlugin

Adds 'workfile' representation if instance is published.

Source code in client/ayon_premiere/plugins/publish/collect_workfile.py
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
class CollectWorkfile(pyblish.api.ContextPlugin):
    """ Adds 'workfile' representation if instance is published. """

    label = "Collect Premiere Workfile Instance"
    order = pyblish.api.CollectorOrder + 0.1

    def process(self, context):
        workfile_instance = None
        for instance in context:
            if instance.data["productType"] == "workfile":
                self.log.debug("Workfile instance found")
                workfile_instance = instance
                break

        if workfile_instance is None:
            self.log.debug("Workfile instance not found. Skipping")
            return

        current_file = context.data["currentFile"]
        staging_dir = os.path.dirname(current_file)
        scene_file = os.path.basename(current_file)

        # creating representation
        workfile_instance.data["representations"].append({
            "name": "prproj",
            "ext": "prproj",
            "files": scene_file,
            "stagingDir": staging_dir,
        })