Skip to content

collect_workfile

CollectWorkfile

Bases: ContextPlugin

Collect current script for publish.

Source code in client/ayon_photoshop/plugins/publish/collect_workfile.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class CollectWorkfile(pyblish.api.ContextPlugin):
    """Collect current script for publish."""

    order = pyblish.api.CollectorOrder + 0.1
    label = "Collect Workfile"
    hosts = ["photoshop"]

    default_variant = "Main"

    def process(self, context):
        for instance in context:
            if instance.data["productType"] == "workfile":
                file_path = context.data["currentFile"]
                _, ext = os.path.splitext(file_path)
                staging_dir = os.path.dirname(file_path)
                base_name = os.path.basename(file_path)

                # creating representation
                _, ext = os.path.splitext(file_path)
                instance.data["representations"].append({
                    "name": ext[1:],
                    "ext": ext[1:],
                    "files": base_name,
                    "stagingDir": staging_dir,
                })
                return