Unique asset_work/asset_publish paths from templates.yml based on Pipeline Step?

Hello all,

I’m attempting to set up naming restrictions for Assets in Projects where there previously were no such restrictions, by using the values in the templates.yml file for a couple of Projects. For the majority of Pipeline Steps, {Asset}_{Step}.v{version}.ma is exactly right for work/publish filenames, e.g. Toothbrush_MOD, Toothbrush_RIG, etc.

The one Pipeline Step where this doesn’t work is Surfacing, as there are, as a standard at my employer’s, two differently suffixed files that come out of that step (one manually created, the other automatically generated using the manual one as a source file), and neither of the suffixes use the pipeline step short name. Hypothetically e.g. Toothbrush_YY, Toothbrush_ZZ. This is legacy, there are already years worth of Asset work/publish files with this naming.

The easy part is making custom Asset keys in templates.yml (e.g. maya_asset_work_surf_yy), but beyond that I’m not sure what module hook to add for Pipeline Step logic that would determine which key to use based on the step.

Another consideration is that I’ll have to do this to both old and new style Shotgun configurations, as one of the Projects is locked into using the old style.

Advice is appreciated! If you need further clarification let me know.




Based on reading some other semi-related posts here, I’m going to try a core/hooks/pick_environment.py modification in conjunction with a custom asset_step_surfacing.yml, and see where that gets me.


That sounds like the right way to go!

You could potentially also use the template_hook to dynamically set the template to use based on the context.
Here is an example on how to use that: