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
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"""
        folder = rt.maxFilePath
        file = rt.maxFileName
        if not folder or not file:
            self.log.error("Scene is not saved.")
        current_file = os.path.join(folder, file)

        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
def process(self, context):
    """Inject the current working file"""
    folder = rt.maxFilePath
    file = rt.maxFileName
    if not folder or not file:
        self.log.error("Scene is not saved.")
    current_file = os.path.join(folder, file)

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