Skip to content

collect_current_file

CollectSilhouetteCurrentFile

Bases: ContextPlugin

Inject the current working file into context

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

    order = pyblish.api.CollectorOrder - 0.5
    label = "Silhouette Current File"
    hosts = ["silhouette"]

    def process(self, context):
        """Inject the current working file"""
        host = registered_host()
        current_file = host.get_current_workfile()
        context.data['currentFile'] = current_file
        if not current_file:
            self.log.warning(
                "Current file is not saved. Save the file before continuing."
            )
        else:
            self.log.debug(f"Current file: {current_file}")

process(context)

Inject the current working file

Source code in client/ayon_silhouette/plugins/publish/collect_current_file.py
12
13
14
15
16
17
18
19
20
21
22
def process(self, context):
    """Inject the current working file"""
    host = registered_host()
    current_file = host.get_current_workfile()
    context.data['currentFile'] = current_file
    if not current_file:
        self.log.warning(
            "Current file is not saved. Save the file before continuing."
        )
    else:
        self.log.debug(f"Current file: {current_file}")