Template Filename Based on task[short] or variant question

I’m having trouble understanding how to properly use Product Type and Variants in AYON.

Here’s my situation:

I have a single Fusion comp with two Saver nodes, both from the same Task (composite):

  • The first Saver publishes the main render. I want its filename to be:Shot1_comp_v01.0001.exr
    (using {foldername}_{task[short]}_{version})
  • The second Saver publishes a mask. I want its filename to be:Shot1_mask_v01.0001.exr

The issue is:
If I use {task[short]} in the template, both comp and mask saver get _comp_ in the name.
If I switch to using {variant}, then both files get _main_ or _mask_, and the “comp” render becomes Shot1_main_v01, which is not what I want.

Question:
Is there a way to apply different filename templates depending on the variant?

What’s the best way to get:

  • Shot1_comp_v01
  • Shot1_mask_v01

Published from the same Fusion comp?

I experimented with adding comp as a variant name but that causes problems with other fusion files that are not type=composite.

I actually think what you’re looking for is to maybe change the default variant in your case to comp instead of Main. So that if you use variant in the template you’d essentially by default get the _comp_. Then you can also add a default mask variant.

So, in your case at setting ayon+settings://fusion/create/CreateSaver/default_variants change it from:

To:

The variants that are not the first ones are available for easy access in the “variant” field on the side in the publisher UI:


I experimented with adding comp as a variant name but that causes problems with other fusion files that are not type=composite.

In what way? As in, you may have Fusion workfiles that do not generate a comp variant by default, but actually something else than comp?

In that case, why not add another variant main or whatever you need to the list (and use those in production.)

I don’t believe there’s currently a way to have the default variant that is chosen be different based on your current context, e.g. “when in task compBG make the variant BG by default”.

I just wanted to remark that the variant field in the publisher UI is a text field, a user can technically enter whatever they want there and it’s not uncommon to generate a variety of variants/products from a task, even beyond just main or mask. So even without changing the settings, you can absolutely choose to produce a different variant from a particular task if the need arises.

Thanks @BigRoy

I got it working once I learned how the Template Name Profiles, Product Name Profiles and the Proj Anatomy Publish settings all reference each other.

By creating a profile for Composite tasks and a separate profile for other composite tasks (such as paint, roto, etc.), I can use different path and filename templates, allowing a composite task to publish sequences based on variants. But a roto task doesn’t want to be published based on the variant name, and those can be published based on the task[short].

Even my diagram confuses me. But I think I have it working.

Do note that “product name” is what makes a product unique under a folder. As such, if the product name profile results in only {variant} it means that it can essentially write into or upversion other product types.

Say you publish a comp render as variant BG resulting in product name BG due to {variant} product name template. And then also publish a maya pointcache in the same shot as variant BG (or a maya render) with a similar product name template {variant} both would end up being product names BG and hence be writing into the same product. Which is most likely not what you’d want.

In your case you’d want {variant} just in your publish template to define the filepath, but still have another way of making the product names unique. The caveat here is however that variant is currently not supported as publish template variable.

Your diagram is correct.
Personally, I’d visualize this abit differently/separately.

  • Set Publish template per product type.
  • Publish Template uses these template keys. Some of these keys are based on AYON context (project name, folder path and task name). you can control some keys such as product[name]. Some other keys are collected on publish time such as frame. So this can be an independant graph.

Thanks, yes this is an important detail. I tried to hel avoid this by making that variant template only apply to Fusion and only to task type composite, so this would be the only time the variant is used in this way.

100% that make sense. While I am figuring out this system, render just seemed to non-specific for me, as every dcc renders, but since fusion and nuke are usually the last task before sending to the client, we like to have a little more specific formating to those.