Skip to content

save_workfile

Save current workfile plugin for Marvelous Designer.

SaveCurrentWorkfile

Bases: ContextPlugin

Save current workfile.

Source code in client/ayon_marvelousdesigner/plugins/publish/save_workfile.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class SaveCurrentWorkfile(pyblish.api.ContextPlugin):
    """Save current workfile."""

    label = "Save current workfile"
    order = pyblish.api.ExtractorOrder - 0.49
    hosts: ClassVar[list[str]] = ["marvelousdesigner"]

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

        Args:
            context (pyblish.api.Context): The publishing context containing
            current file information.

        Raises:
            KnownPublishError: If the workfile has changed during publishing.
        """
        host = registered_host()
        current = host.get_current_workfile()
        if context.data["currentFile"] != current:
            msg = "Workfile has changed during publishing!"
            raise KnownPublishError(msg)

        if host.workfile_has_unsaved_changes():
            self.log.info("Saving current file: %s", current)
            host.save_workfile(current)
        else:
            self.log.debug("No unsaved changes, skipping file save.")

process(context)

Process the context to save the current workfile.

Parameters:

Name Type Description Default
context Context

The publishing context containing

required

Raises:

Type Description
KnownPublishError

If the workfile has changed during publishing.

Source code in client/ayon_marvelousdesigner/plugins/publish/save_workfile.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def process(self, context: pyblish.api.Context) -> None:
    """Process the context to save the current workfile.

    Args:
        context (pyblish.api.Context): The publishing context containing
        current file information.

    Raises:
        KnownPublishError: If the workfile has changed during publishing.
    """
    host = registered_host()
    current = host.get_current_workfile()
    if context.data["currentFile"] != current:
        msg = "Workfile has changed during publishing!"
        raise KnownPublishError(msg)

    if host.workfile_has_unsaved_changes():
        self.log.info("Saving current file: %s", current)
        host.save_workfile(current)
    else:
        self.log.debug("No unsaved changes, skipping file save.")