Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created August 11, 2023 13:35
Show Gist options
  • Save BigRoy/ce3e6dec2e74efd7caafaa7054caaea0 to your computer and use it in GitHub Desktop.
Save BigRoy/ce3e6dec2e74efd7caafaa7054caaea0 to your computer and use it in GitHub Desktop.
OpenPype list all workfiles from a folder that were involved in a publish (= list all workfiles that were published from)
# Return all source workfile paths in a workfile folder that were involved in a publish
import re
from openpype.pipeline import legacy_io, Anatomy
from openpype.pipeline.context_tools import get_current_project_name
project_name = get_current_project_name()
anatomy = Anatomy(project_name)
folder = r"path/to/workfiles/folder
success, folder = anatomy.find_root_template_from_path(folder)
files_in_folder_query = re.escape(folder) + "/[^/]+"
published_workfiles = legacy_io.distinct("data.source", {"type": "version", "data.source": re.compile(files_in_folder_query)})
for workfile in published_workfiles:
print(workfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment