From 47af183d04f82ccc5d27af20143ee03ddf8eeb49 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 31 Jul 2025 12:12:00 +0200 Subject: [PATCH 1/3] check for availability that don't live in workdir --- client/ayon_core/host/interfaces/workfiles.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/host/interfaces/workfiles.py b/client/ayon_core/host/interfaces/workfiles.py index b6c33337e9..693aac5fe5 100644 --- a/client/ayon_core/host/interfaces/workfiles.py +++ b/client/ayon_core/host/interfaces/workfiles.py @@ -1155,12 +1155,15 @@ class IWorkfileHost: comment = parsed_data.comment filepath = list_workfiles_context.anatomy.fill_root(rootless_path) + available = False + if filepath != rootless_path: + available = os.path.exists(filepath) items.append(WorkfileInfo.new( filepath, rootless_path, version=version, comment=comment, - available=False, + available=available, workfile_entity=workfile_entity, )) From 4f296e0ed78138cef63791605c40e1a6b82e7ebf Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 31 Jul 2025 12:41:33 +0200 Subject: [PATCH 2/3] simplified --- client/ayon_core/host/interfaces/workfiles.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/ayon_core/host/interfaces/workfiles.py b/client/ayon_core/host/interfaces/workfiles.py index 693aac5fe5..14e60bda20 100644 --- a/client/ayon_core/host/interfaces/workfiles.py +++ b/client/ayon_core/host/interfaces/workfiles.py @@ -1155,9 +1155,7 @@ class IWorkfileHost: comment = parsed_data.comment filepath = list_workfiles_context.anatomy.fill_root(rootless_path) - available = False - if filepath != rootless_path: - available = os.path.exists(filepath) + available = os.path.exists(filepath) items.append(WorkfileInfo.new( filepath, rootless_path, From 8e2f33d483791c606cdbc4230e04be2ad88f6889 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:23:44 +0200 Subject: [PATCH 3/3] use filepath instead of rootless path for workfile entity mapping --- client/ayon_core/host/interfaces/workfiles.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/host/interfaces/workfiles.py b/client/ayon_core/host/interfaces/workfiles.py index 14e60bda20..b519751ba2 100644 --- a/client/ayon_core/host/interfaces/workfiles.py +++ b/client/ayon_core/host/interfaces/workfiles.py @@ -1072,10 +1072,13 @@ class IWorkfileHost: prepared_data=prepared_data, ) - workfile_entities_by_path = { - workfile_entity["path"]: workfile_entity - for workfile_entity in list_workfiles_context.workfile_entities - } + workfile_entities_by_path = {} + for workfile_entity in list_workfiles_context.workfile_entities: + rootless_path = workfile_entity["path"] + path = os.path.normpath( + list_workfiles_context.anatomy.fill_root(rootless_path) + ) + workfile_entities_by_path[path] = workfile_entity workdir_data = get_template_data( list_workfiles_context.project_entity, @@ -1114,10 +1117,10 @@ class IWorkfileHost: rootless_path = f"{rootless_workdir}/{filename}" workfile_entity = workfile_entities_by_path.pop( - rootless_path, None + filepath, None ) version = comment = None - if workfile_entity: + if workfile_entity is not None: _data = workfile_entity["data"] version = _data.get("version") comment = _data.get("comment") @@ -1137,7 +1140,7 @@ class IWorkfileHost: ) items.append(item) - for workfile_entity in workfile_entities_by_path.values(): + for filepath, workfile_entity in workfile_entities_by_path.items(): # Workfile entity is not in the filesystem # but it is in the database rootless_path = workfile_entity["path"] @@ -1154,7 +1157,6 @@ class IWorkfileHost: version = parsed_data.version comment = parsed_data.comment - filepath = list_workfiles_context.anatomy.fill_root(rootless_path) available = os.path.exists(filepath) items.append(WorkfileInfo.new( filepath,