Skip to content

increment_current_file

IncrementCurrentFile

Bases: ContextPlugin, OptionalPyblishPluginMixin

Increment the current file.

Saves the current scene with an increased version number.

Source code in client/ayon_silhouette/plugins/publish/increment_current_file.py
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
class IncrementCurrentFile(pyblish.api.ContextPlugin,
                           OptionalPyblishPluginMixin):
    """Increment the current file.

    Saves the current scene with an increased version number.
    """
    label = "Increment current file"
    order = pyblish.api.IntegratorOrder + 9.0
    families = ["*"]
    hosts = ["silhouette"]
    optional = True

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

        # Filename must not have changed since collecting
        host = registered_host()
        current_file = host.current_file()
        if context.data["currentFile"] != current_file:
            raise KnownPublishError(
                "Collected filename mismatches from current scene name."
            )

        new_filepath = version_up(current_file)
        host.save_workfile(new_filepath)