Skip to content

increment_current_file

FusionIncrementCurrentFile

Bases: ContextPlugin, OptionalPyblishPluginMixin

Increment the current file.

Saves the current file with an increased version number.

Source code in client/ayon_fusion/plugins/publish/increment_current_file.py
 7
 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
36
37
38
39
40
41
42
43
44
class FusionIncrementCurrentFile(
    pyblish.api.ContextPlugin, OptionalPyblishPluginMixin
):
    """Increment the current file.

    Saves the current file with an increased version number.

    """

    label = "Increment workfile version"
    order = pyblish.api.IntegratorOrder + 9.0
    hosts = ["fusion"]
    optional = True

    def process(self, context):
        if not self.is_active(context.data):
            return

        from ayon_core.lib import version_up
        from ayon_core.pipeline.publish import get_errored_plugins_from_context

        errored_plugins = get_errored_plugins_from_context(context)
        if any(
            plugin.__name__ == "FusionSubmitDeadline"
            for plugin in errored_plugins
        ):
            raise KnownPublishError(
                "Skipping incrementing current file because "
                "submission to render farm failed."
            )

        comp = context.data.get("currentComp")
        assert comp, "Must have comp"

        current_filepath = context.data["currentFile"]
        new_filepath = version_up(current_filepath)

        comp.Save(new_filepath)