We are using the Shotgun Standalone Publisher to publish different files types which should get copied to the Publish template paths. Is there any way to define the Publish templates for different published file types which will get copied to the desired publish paths through the standalone publish.
Hi welcome to the forums!
Great question, it’s one we’ve seen come up a few times.
Our standalone publisher doesn’t support templates out of the box. However, if you’re comfortable writing python code, you can modify the publish plugin to add support for it.
You would take over this publish2 plugin:
Then you would modify the settings section to add the ability to define PublishedFileTypes with templates.
After that you would modify the accept and publish methods to make use of the template, resolve the path and copy the file there. I would use something like the
tk-maya's publish_session hook as an example of how to handle templates:
The main difference would be that you need to get the template based on
PublishedFileType, and you wouldn’t be saving a file but copying it instead.
As someone else asked about this from elsewhere, I thought I’d just add a few more details.
For an example on how to add a template setting to your publish plugin, you could use the Maya plugin as an example. The plugin defines the publish template here:
And the actual template value is assigned in the environment settings here:
Though in the case of the question this wouldn’t want to be configured quite like this, as you would want to get the appropriate setting containing the template for the given file type instead.
The plugin then makes use of the template here:
I’ve posted an example of how to do this here: