From 0f71a89f888ecbfa66e6b245c460830428184087 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 15 Mar 2024 21:31:05 +0800 Subject: [PATCH] make sure the scene file would be saved and increment before deadline submission --- .../max/plugins/publish/increment_workfile_version.py | 2 +- .../ayon_core/hosts/max/plugins/publish/save_scene.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/ayon_core/hosts/max/plugins/publish/increment_workfile_version.py b/client/ayon_core/hosts/max/plugins/publish/increment_workfile_version.py index 5f319966fe..c7c3f49626 100644 --- a/client/ayon_core/hosts/max/plugins/publish/increment_workfile_version.py +++ b/client/ayon_core/hosts/max/plugins/publish/increment_workfile_version.py @@ -9,7 +9,7 @@ class IncrementWorkfileVersion(pyblish.api.ContextPlugin): order = pyblish.api.IntegratorOrder + 0.9 label = "Increment Workfile Version" hosts = ["max"] - families = ["workfile"] + families = ["maxrender", "workfile"] def process(self, context): path = context.data["currentFile"] diff --git a/client/ayon_core/hosts/max/plugins/publish/save_scene.py b/client/ayon_core/hosts/max/plugins/publish/save_scene.py index 1c59335ceb..fe2c7f50f4 100644 --- a/client/ayon_core/hosts/max/plugins/publish/save_scene.py +++ b/client/ayon_core/hosts/max/plugins/publish/save_scene.py @@ -2,7 +2,7 @@ import pyblish.api from ayon_core.pipeline import registered_host -class SaveCurrentScene(pyblish.api.ContextPlugin): +class SaveCurrentScene(pyblish.api.InstancePlugin): """Save current scene""" label = "Save current file" @@ -10,13 +10,15 @@ class SaveCurrentScene(pyblish.api.ContextPlugin): hosts = ["max"] families = ["maxrender", "workfile"] - def process(self, context): + def process(self, instance): host = registered_host() current_file = host.get_current_workfile() - assert context.data["currentFile"] == current_file + assert instance.context.data["currentFile"] == current_file + if instance.data["productType"] == "maxrender": + host.save_workfile(current_file) - if host.workfile_has_unsaved_changes(): + elif host.workfile_has_unsaved_changes(): self.log.info(f"Saving current file: {current_file}") host.save_workfile(current_file) else: