Skip to content

collect_current_file

CollectCurrentFile

Bases: ContextPlugin

Inject the current working file.

Source code in client/ayon_max/plugins/publish/collect_current_file.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
class CollectCurrentFile(pyblish.api.ContextPlugin):
    """Inject the current working file."""

    order = pyblish.api.CollectorOrder - 0.5
    label = "Max Current File"
    hosts = ['max']

    def process(self, context):
        """Inject the current working file"""
        host = registered_host()
        current_file = host.get_current_workfile()
        if not current_file:
            self.log.error("Scene is not saved.")

        context.data["currentFile"] = current_file
        self.log.debug("Scene path: {}".format(current_file))

process(context)

Inject the current working file

Source code in client/ayon_max/plugins/publish/collect_current_file.py
12
13
14
15
16
17
18
19
20
def process(self, context):
    """Inject the current working file"""
    host = registered_host()
    current_file = host.get_current_workfile()
    if not current_file:
        self.log.error("Scene is not saved.")

    context.data["currentFile"] = current_file
    self.log.debug("Scene path: {}".format(current_file))