SG / Flow - adding path to frames field

Hey all!
Our studio has some custom tools for reviewing and delivery that require the sg_path_to_frames field to be filled in on SG versions.
When the reviewable representation is a video, the SG/Flow addon fills in path_to_movie but not path_to_frames

Here’s the modifications we made to the integrate_shotgrid_version.py to remedy this. This operates on video representations, looking through other representations for image sequences, and steals the path_to_frames from there.

integrate_shotgrid_version.py changes

starting at line 57:

if f".{representation['ext']}" in VIDEO_EXTENSIONS:
    found_reviewable = True
    data_to_update["sg_path_to_movie"] = local_path
    ################################### FA Custom stuff start ###################################
    for representationSecondary in instance.data.get("representations", []):
        if f".{representationSecondary['ext']}" in IMAGE_EXTENSIONS and "thumbnail" not in f".{representationSecondary['name']}":
            frames_path = get_publish_repre_path(
                instance, representationSecondary, False
            )
            path_to_frames = re.sub(r"\.\d+\.", ".####.", frames_path)
            data_to_update["sg_path_to_frames"] = path_to_frames
            self.log.debug(f"setting path_to_frames to {path_to_frames}")
    ################################### FA Custom stuff end #####################################

Not sure if this is something that others need or want, or if it deserves official implementation or anything like that (this is functional but definitely inefficient).

Update- I’ll have to work on this further, it would be good to specify which exact representation to steal the path from

1 Like

Hello,
Thanks for your contribution.

Could create a PR to ayon-shotgrid?
It’ll be helpful and easier for others to check the changes in the PR.
Also, it might find its way to the official addon :wink:

PR made! Filling SG versions path_to_frames by ReeceMulley · Pull Request #131 · ynput/ayon-shotgrid · GitHub

1 Like

Thank you for your contribution :heart_hands: