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)
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 theexport_type
setting. Then in your plugin code you could do a different export depending on the export_type value of the plugin instance.
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.
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
- 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
- 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
- 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
- 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",
}
- During the âacceptâ phase, I check the âExport Formatâ setting against the stored export format values.
- 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
Thanks for following up and sharing back, @clintond!
@clintond , if you could share the code here. It gives better view of how it works