Skip to content

collect_current_file

Plugin for collecting the current working file in Marvelous Designer.

This module provides a Pyblish plugin that injects the current working file path into the publish context for Marvelous Designer projects.

CollectCurrentFile

Bases: ContextPlugin

Inject the current working file into context.

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

    order = pyblish.api.CollectorOrder - 0.49
    label = "Current Workfile"
    hosts: ClassVar[list[str]] = ["marvelousdesigner"]

    def process(self, context: pyblish.api.Context) -> None:
        """Process the context to inject current workfile path.

        Args:
            context (pyblish.api.Context): The publish context to modify.
        """
        host = registered_host()
        path = host.get_current_workfile()
        if not path:
            self.log.error("Scene is not saved.")

        context.data["currentFile"] = path
        self.log.debug("Current workfile: %s", path)

process(context)

Process the context to inject current workfile path.

Parameters:

Name Type Description Default
context Context

The publish context to modify.

required
Source code in client/ayon_marvelousdesigner/plugins/publish/collect_current_file.py
20
21
22
23
24
25
26
27
28
29
30
31
32
def process(self, context: pyblish.api.Context) -> None:
    """Process the context to inject current workfile path.

    Args:
        context (pyblish.api.Context): The publish context to modify.
    """
    host = registered_host()
    path = host.get_current_workfile()
    if not path:
        self.log.error("Scene is not saved.")

    context.data["currentFile"] = path
    self.log.debug("Current workfile: %s", path)