Skip to content

collect_wrap_workfile

CollectWrapWorkfile

Bases: InstancePlugin

Collect current workfile for publish.

Source code in client/ayon_wrap/plugins/publish/collect_wrap_workfile.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
class CollectWrapWorkfile(pyblish.api.InstancePlugin):
    """Collect current workfile for publish."""

    order = pyblish.api.CollectorOrder + 0.2
    label = "Collect Wrap Workfile"
    hosts = ["traypublisher"]

    families = ["workfile"]

    def process(self, instance):
        is_wrap = is_wrap_instance(instance, self.log)
        if not is_wrap:
            return

        workfile_path = instance.data["wrap"]["workfile_path"]
        workfile_name = os.path.basename(workfile_path)
        staging_dir = os.path.dirname(workfile_path)
        _, ext = os.path.splitext(workfile_name)
        workfile_representation = {
            "name": ext[1:],
            "ext": ext[1:],
            "files": workfile_name,
            "stagingDir": staging_dir,
        }

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