Saving and accessing extra publish data in

Hey folks - probably a simple question, but the answer is eluding me for some reason.

I’ve been writing custom publish plugins, and would like to pass along the name of a particular asset when publishing alembic data for a shot. Then I’d like to access this information when loading published data through the loader via a custom

I believe I’m storing the data correctly, by setting it in the collector:["asset"] = asset

and then in the publish plugin I also make sure to set it:["asset"] = asset

But I’m not sure how to access that data in the
I thought it would be available in sg_publish_data, but can’t seem to find it. Any suggestions?



Hi Jason

OK so setting the asset in the collector like that looks good to me.

But then in the plugin I would expect you to extract it, not set it again? The plugin is what is responsible for publishing the data to Shotgun, so should in theory be grabbing the asset you assigned at collection time and adding that value to the PublishedFile entity that is getting created in Shotgun.

In order to access the Asset in the loader app, you would have to make sure that the Asset is set on the PublishedFile entity in Shotgun. Now you mentioned that this PublishedFile was for some alembic data on a Shot, so I assume that the PublishedFile will be attributed to the Shot in the default entity field? Do you have a custom field you are wanting to add the Asset association in?

Once you have figured out where you are going to store the Asset relationship on the PublishedFile entity, you then need to get the publish plugin to populate it. Now I don’t know how your publish plugin is set up, but if you are deriving from the plugin that comes with the publisher, and you’re leaving that to handle the creation of the PublishedFile then you need to set["publish_kwargs"] = {"sg_asset": asset} (where sg_asset is renamed to match the actual field code you want to add the data to in Shotgun on the PublishedFile.), then the base plugin will make sure that when it creates the PublishedFile the asset field will be populated as well.
If you’re not using hook inheritance and relying on the, and you’re handing the creation of the PublishedFile your self, then you just need to make sure that you set the asset on the appropriate field.

When it comes to the loader hook, the published data that is provided, will contain values for the fields that the loader asks for, and those fields are hardcoded into the app, so it won’t go and grab your custom field if you are indeed using one. If you are just setting the Asset on the entity field then that will be provided. So if you are using a custom field, then you will need to perform a second look up for the entity in Shotgun using the Shotgun API to get the extra field data.

Let me know if any of that doesn’t make sense.


Hi Philip

Do mind elaborating on this a little?

My publishes contain custom fields which I’ve populated during publish, and now I’d like to access that data, and add it to the Loader UI.

Ideally, I’d love much more customisation on the layout/filtering of Loader items/tree, but will save submitting a feature improvement for another day.


1 Like