Skip to content

Commit

Permalink
Fix Version follow up from Workfile set by hosts.
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-ynput committed Jan 29, 2025
1 parent 283465b commit d25c470
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 13 additions & 2 deletions client/ayon_core/pipeline/create/creator_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,13 +858,24 @@ def get_staging_dir(self, instance) -> Optional[StagingDir]:
["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)

Expand Down
7 changes: 7 additions & 0 deletions client/ayon_core/plugins/publish/collect_scene_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def process(self, context):
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.")
Expand Down

0 comments on commit d25c470

Please sign in to comment.