Publish2 use custom templates

Hi everyone ! Another request to this amazing community.

What I want to do
I need to publish two different kind of scenes:

  • Publish scenes
  • Template publish scenes


  • Work scenes
  • Template work scenes

In my settings I defined templates for each of these scene types.

Giving me something like this:

  definition: '@Asset_Houdini_WorkArea/@lod_basename.hip'
  root_name: 'primary'
  definition: '@Asset_Houdini_PublishArea/@lod_basename.hip'
  root_name: 'primary'
  definition: '@Asset_Houdini_WorkArea/template/@lod_basename.hip'
  root_name: 'primary'
  definition: '@Asset_Houdini_PublishArea/template/@lod_basename.hip'
  root_name: 'primary'

I need to be able to understand if a file is a template work file or a work file AND to be able to publish it as a template publish file or a publish file.

Where I’m stuck ?

At the begining, to be honest, I added some UI parts to let my users to choose beetween a template publish file or a publish file, but I can’t find a way to tell the publisher which work template and publish template to use.

In fact I can’t find where the[“work_template”] and[“publish_template”] are set…

Any idea ?


I think Sgtk.template_from_path should do what you need here. Give it your path and assuming it matches it will return the template.

Using Maya as an example, the work_template is set here:

And collector code gets the actual value from the app settings and defines it on the item here:

A similar thing goes for the publish_template

The actual value is defined here:

And that is retrieved by the publish plugin here:

Though really I find the fact that it sets the publish template during validation, a bit of an abuse of the process. I think ideally it should be set in the accept.

1 Like

Thanks for all !
I found a way to assign the right template to the items in the validate() using template_from_path and it works fine, perhaps add it to the accept is a better solution yes.