I use a custom hook_scene_operations hook. Inside this hook, I would like to retrieve some information about the new versions of the items. I would like to retrieve the value of some publish field on the new item.
I added the ‘published_file_fields’ to this app config :
So the item you are referring to is a FileItem object. These items represent the objects in your scene. The item’s sg_data property is the ShotGrid published file data related to the scene object, which is where you can retrieve the information you are looking for. The published_file_fields app config setting is a list of published file fields that will be used to retrieve the sg_data, so any fields you include in this list will be included in the sg_data.
An example of how you can retrieve the published file field data from a hook can be found in this hook, or below is a very basic example:
def get_published_file_info_example(self, item):
# item is a FileItem object
name = item.sg_data["name"]
In the example above, we are simply accessing the published file data using item.sg_data["field_name"], so for your specific published_file_fields listed above, you could also get the audio frame start data using item.sg_data["sg_audio_frame_start"].
The default published file fields that will be fetched are listed here – these fields do not need to be added to your app config setting, they will always be included in the sg_data (you do not need to include “name” in your settings).