Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process the TemplateKey value before storing it #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kporangehat
Copy link


NOTE: This is a replacement PR as we erroneously purged the repo from #80 which should be closed in favor of this one)


Fix for incorrect File Key being generated when TemplateKeys have additional parameters that require processing. Previously, the File Key would be generated using the raw values of the TemplateKeys - with this change it is generated with the processed value (using str_from_value()).

The way this manifests itself, specifically when executing a File Save... The app uses the File Key to determine any matching files that are currently present on the filesystem. It then calculates the version_number by using the highest value for version_number from all files that exist with the given File Key, and adding 1. If no files are found matching the File Key, then 1 is used.

For a TemplateKey defined as so:

    sg_asset_name_letter:
        type: str
        shotgun_entity_type: Asset
        shotgun_field_name: code
        subset: "(.{1}).*"

the raw value for sg_asset_name_letter will be "MyAssetName", while the processed value will be "M". (the subset isn't applied until you run str_from_value()). If your work template uses this key, when it writes out the files to the filesystem, they will be saved using "M" as the processed value.

Then later when you execute a Save As... to try and version up, a File Key is generated for the current work file, which has ("sg_asset_name_letter", "MyAssetName") in it. While the file saved on the filesystem will have ("sg_asset_name_letter", "M") in the File Key and will not be considered the same file. Therefor it will be incorrectly ignored when calculating the next version number.

This fix ensures the File Key is generated with the processed value of the TemplateKeys so that they will always correctly match any files on the filesystem.

@kporangehat
Copy link
Author

So five years later... we still have to fork the app for this fix. Would love to see if it could get merged someday... 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Logged Logged in Jira
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants