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
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.")

        if platform.system().lower() == "windows":
            current_file = current_file.replace("\\", "/")

        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
14
15
16
17
18
19
20
21
22
23
24
25
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.")

    if platform.system().lower() == "windows":
        current_file = current_file.replace("\\", "/")

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