Skip to content

collect_workfile

CollectWorkfileData

Bases: MayaInstancePlugin

Inject data into Workfile instance

Source code in client/ayon_maya/plugins/publish/collect_workfile.py
 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
31
32
33
34
35
36
class CollectWorkfileData(plugin.MayaInstancePlugin):
    """Inject data into Workfile instance"""

    order = pyblish.api.CollectorOrder - 0.01
    label = "Maya Workfile"
    families = ["workfile"]

    def process(self, instance):
        """Inject the current working file"""

        context = instance.context
        current_file = instance.context.data['currentFile']
        folder, file = os.path.split(current_file)
        filename, ext = os.path.splitext(file)

        data = {  # noqa
            "setMembers": [current_file],
            "frameStart": context.data['frameStart'],
            "frameEnd": context.data['frameEnd'],
            "handleStart": context.data['handleStart'],
            "handleEnd": context.data['handleEnd']
        }

        data['representations'] = [{
            'name': ext.lstrip("."),
            'ext': ext.lstrip("."),
            'files': file,
            "stagingDir": folder,
        }]

        instance.data.update(data)

process(instance)

Inject the current working file

Source code in client/ayon_maya/plugins/publish/collect_workfile.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
def process(self, instance):
    """Inject the current working file"""

    context = instance.context
    current_file = instance.context.data['currentFile']
    folder, file = os.path.split(current_file)
    filename, ext = os.path.splitext(file)

    data = {  # noqa
        "setMembers": [current_file],
        "frameStart": context.data['frameStart'],
        "frameEnd": context.data['frameEnd'],
        "handleStart": context.data['handleStart'],
        "handleEnd": context.data['handleEnd']
    }

    data['representations'] = [{
        'name': ext.lstrip("."),
        'ext': ext.lstrip("."),
        'files': file,
        "stagingDir": folder,
    }]

    instance.data.update(data)