Skip to content

collect_mocha_project

Collect the current Mocha Pro project.

CollectMochaProject

Bases: ContextPlugin

Inject the current working file into context.

Foo batr baz.

Source code in client/ayon_mocha/plugins/publish/collect_mocha_project.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class CollectMochaProject(pyblish.api.ContextPlugin):
    """Inject the current working file into context.

    Foo batr baz.
    """

    order = pyblish.api.CollectorOrder - 0.5
    label = "Collect Mocha Pro Project"
    hosts: ClassVar[list[str]] = ["mochapro"]
    log: Logger

    def process(self, context: pyblish.api.Context) -> None:
        """Inject the current working file."""
        context.data["project"] = get_current_project()
        current_file = context.data["project"].project_file
        context.data["currentFile"] = current_file
        if not current_file:
            self.log.warning(
                "Current file is not saved. Save the file before continuing."
            )

process(context)

Inject the current working file.

Source code in client/ayon_mocha/plugins/publish/collect_mocha_project.py
24
25
26
27
28
29
30
31
32
def process(self, context: pyblish.api.Context) -> None:
    """Inject the current working file."""
    context.data["project"] = get_current_project()
    current_file = context.data["project"].project_file
    context.data["currentFile"] = current_file
    if not current_file:
        self.log.warning(
            "Current file is not saved. Save the file before continuing."
        )