Tk-multi-publish2 - hooks - upload_version.py

Hi All,

I’m currently working on customizing publish workflows for review media.
Using these guides for the same:
https://community.shotgridsoftware.com/t/publish2-custom-plugin-ui-example/2981

https://www.youtube.com/watch?v=pH4mylrnktY

Was hoping for a bit a guidance for making the following modifications:

  1. Modifying path_to_movie to copy media to production file system
    e.g. Default config2 creates a folder structure like so: /storage/projects/my_proj/assets/{asset_type}/{asset_name}/{step}/publish, reference, review, work
    Is the above path (assets/{asset_type}/{asset_name}/{step}/review) meant for storing review media? If so, will try to make path_to_movie to point to read like so: assets/{asset_type}/{asset_name}/{step}/review/media.mov or any other specified directory.
  2. Forcing the filename and version name template to mimic the file naming from templates. e.g. AssetName_{step}_{version}.extension
  3. Disabling sg_uploaded_movie and using sg_local_file_path to point to the above path instead.

Summary: enforcing Version naming templates, save location templates, updating field data on Version entity during publish execution of plugins. Guidance or doc links for customizing with hooks in general.

Request some guidance for the above.

Thank you

2 Likes

Hi @sbasu!

Can you clarify your questions a bit? First off, what software are we talking about here – Nuke? or something else?

It sounds like, in general, you’re interested in using templates in your custom code. This is totally doable. You can see an example of using a template to build a path in this developer guide. You could use similar logic in your custom code. And here is reference documentation for working with templates with the Toolkit API.

It can be. We don’t really prescribe what different paths should be used for – there are no dependencies that expect reviewable media to be stored here, but it makes sense to use it as such.

Can you clarify this question, please? I’m not sure I understand.

Can you clarify this as well? Where do you want to disable these things? Are you interested in disabling the fields on the Version entity? If so, why?

Thanks!

1 Like

Hi Tannaz!

Thank you for the doc links.

To follow up,

The tk-multi-publish2 app in any engine [Maya, Nuke, Houdini, etc] as well as standalone.

When artists save the workfile (tk-multi-workfiles2?) or publish files and review media (tk-multi-publish2), we were hoping to enforce naming conventions on those file names. (e.g. for a Character Bob, a Maya file in the Model context, when artists save the file through the Shotgun menu, file gets saved to assets/character/Bob/Model/work/Bob_Mo_v01.ma. Similar nomenclature template for publish and review media as well.) I will refer to the doc links you have sent for this.

I have figured this out. Modified the upload_version.py hook from here: https://github.com/shotgunsoftware/tk-multi-publish2/blob/master/hooks/upload_version.py#L96

Modified the the value for the ‘default’ key to ‘False’.

Thank you.

1 Like

Thanks for clarifying! That’s very helpful.

I understand now what you’re going for and I think you’re on the right track. In broad strokes, you’ll want to add your desired templates for review media to your core/templates.yml file, then modify the upload_version hook to include logic to rename things based on those templates.

Good luck - let us know if you hit any snags!

2 Likes

Sure. I’ll test the same and revert back.

Thank you!

2 Likes