Publishing Multiple Formats in one go

Hi,
I am customizing Maya Publish to publish cameras on the lines of the SG webinar of customizing publish workflow. Requirement is to publish camera in .fbx, .ma and alembic cache all 3 together. Please let know the legit way, so on SG we get 3 notifications (1 for each format)

3 Likes

Hi Ankur

Yes that should be totally doable.
I don’t know if you’ve seen this but we have a tutorial that covers setting up camera publishing.
As for exporting three different formats for the camera, you have at least a couple of options, you could:

  • Do it all in one publish plugin, where you export and publish three different outputs.
  • Create one plugin, with a setting (for example export_type), and define it three times in the publish app settings, each with a different value for the export_type setting. Then in your plugin code you could do a different export depending on the export_type value of the plugin instance.
2 Likes

Hi Philip

Do you mind expanding on this a little more?

I’m also interested in a similar scenario to the OP, but with a slight variation; I want user level control of the formats that are exported per-asset.

Eg, asset1 exports MB/ABC, asset2 exports MB/USD.

For now, I’ve created a front-end for adding the required formats to the assets and the collector retrieves and stores these attributes on the items (meaning, I can query this info during the publish process).

Any further explanation of these topics would really help me, as I’m struggling to get this working without a LOT of custom code within the publish plugin (which doesn’t seem like the correct approach).

Thanks.

1 Like

Okay, after three days trying so many variations on this, with approaches that felt like they were going to work, only to fail, I re-read the guidance from Philip and really tried to make sense of the approach being suggested. And now it’s working.

The difference from the OP, was having per-format control on a per-object basis.

As Philip suggested, the approach was to provide an interface to the publish plugin for each format that could be used for exporting. Without filtering, this meant that each object had multiple ‘sub-publishes’ under it. Then, the ‘accept’ logic determined on a per-object basis if that format was going to be used on the object in question, which limited the exports to the formats requested by the artist. It does this by querying metadata on the object regarding the export formats it wants to use (driven from an artist UI).

This might be of use to someone else, so here’s the approach Philip suggested:

templates.yml

  1. I defined a new path definition with the following keys;

maya_shot_asset_publish:
definition: ‘@shot_root/publish/{name}/v{version}/{asset_format}/{Shot}{Step}{name}.v{version}.{asset_format}’

tk-multi-publish2.yml

  1. I added multiple references to the same publish.py, but for each reference, changed a custom setting named ‘Export Format’. This shows the “MB” reference, but there were additional entries for each required format (perhaps this can be done more succinctly?).

- name: Publish MB
hook: “{self}/publish_file.py:{config}/tk-multi-publish2/publish.py”
settings:
Publish Template: maya_shot_asset_publish
Export Format: “MB”

collector.py

  1. When adding the items to the list, I added extra properties regarding the export format. That is, each object stored a YES/NO for each format.

publish.py

  1. Added a new ‘setting’ to the ‘settings’ definition for the ‘Export Format’.
"Export Format": { "type": "list", "default": None, "description": "Formats used to export the asset", }
  1. During the ‘accept’ phase, I check the ‘Export Format’ setting against the stored export format values.
  2. Within the publish definition, I build a unique export string for each format, based on the ‘Export Format’ setting.

–

In the end, it only took a couple of hours to implement this, but it was the correct approach that had me stumped for a few days as I couldn’t quite make sense of the suggested approach at first.

I hope that helps someone else trying to do something similar.

clinton

2 Likes

Thanks for following up and sharing back, @clintond!

@clintond , if you could share the code here. It gives better view of how it works