From d25c4701d1ec09f1aa81b9a80b356e79e3215456 Mon Sep 17 00:00:00 2001 From: "robin@ynput.io" Date: Wed, 29 Jan 2025 12:04:38 +0100 Subject: [PATCH] Fix Version follow up from Workfile set by hosts. --- .../ayon_core/pipeline/create/creator_plugins.py | 15 +++++++++++++-- .../plugins/publish/collect_scene_version.py | 7 +++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/pipeline/create/creator_plugins.py b/client/ayon_core/pipeline/create/creator_plugins.py index 445b41cb4b..f29d67f263 100644 --- a/client/ayon_core/pipeline/create/creator_plugins.py +++ b/client/ayon_core/pipeline/create/creator_plugins.py @@ -858,13 +858,24 @@ class Creator(BaseCreator): ["CollectAnatomyInstanceData"] ["follow_workfile_version"] ) + follow_version_hosts = ( + publish_settings + ["CollectSceneVersion"] + ["hosts"] + ) + + current_host = create_ctx.host.name + follow_workfile_version = ( + follow_workfile_version and + current_host in follow_version_hosts + ) # Gather version number provided from the instance. + current_workfile = create_ctx.get_current_workfile_path() version = instance.get("version") # If follow workfile, gather version from workfile path. - if version is None and follow_workfile_version: - current_workfile = self.create_context.get_current_workfile_path() + if version is None and follow_workfile_version and current_workfile: workfile_version = get_version_from_path(current_workfile) version = int(workfile_version) diff --git a/client/ayon_core/plugins/publish/collect_scene_version.py b/client/ayon_core/plugins/publish/collect_scene_version.py index 8d643062bc..8758bc2181 100644 --- a/client/ayon_core/plugins/publish/collect_scene_version.py +++ b/client/ayon_core/plugins/publish/collect_scene_version.py @@ -46,6 +46,13 @@ class CollectSceneVersion(pyblish.api.ContextPlugin): self.log.debug("Skipping for headless publishing") return + if context.data["hostName"] not in self.hosts: + self.log.debug( + f"Host {context.data['hostName']} is" + " not setup for following version." + ) + return + if not context.data.get('currentFile'): self.log.error("Cannot get current workfile path. " "Make sure your scene is saved.")