Hi. How can one find out what assets are linked to a particular shot? And if there are some custom fields in that link (added by going Shots->myShot->Assets, then 'Add New Asset-in-Shot Field'), how can one get their values?
Thanks
Hi. How can one find out what assets are linked to a particular shot? And if there are some custom fields in that link (added by going Shots->myShot->Assets, then 'Add New Asset-in-Shot Field'), how can one get their values?
Thanks
ok, i think i got it, although i swear i tried the same piece of code yesterday and it did not work:
find("AssetShotConnection",
filters=[['shot', 'is', {'valid': 'valid', 'type': 'Shot', 'name': 'myShot', 'id': 1}]],
fields=['all'],
order=[],
filter_operator='all')
Hey Andrei,
If you simply need to look up the assets in a shot you can do so by specifying the 'assets' field in your fields array.
fields = ['code','assets'] filters = [['id','is',123]] shot = sg.find('Shot',filters,fields)
Will return:
[{'assets': [{'id': 41, 'name': 'Truck_2', 'type': 'Asset', 'valid': 'valid'}],
'code': '100_010',
'id': 123}]
But when you want to access the fields that were created on that Shot<->Asset link as well, you take a slightly different route by executing a find() on the link itself instead of the Shot. Say you had a field called 'Continuity Note' on the Asset<->Shot connection:
fields = ['asset','shot','sg_continuity_note'] filters = [['shot','is',{'type':'Shot','id':123}]] result = sg.find('AssetShotConnection',filters,fields)
Will return:
[{'asset': {'id': 41, 'name': 'Truck_2', 'type': 'Asset', 'valid': 'valid'},
'id': 552,
'sg_continuity_note': 'this is a continuity note',
'shot': {'id': 123, 'name': '100_010', 'type': 'Shot', 'valid': 'valid'}}]
Remember when filtering by an entity field (like Shot, or Asset), you have to provide a dict as the filter value {'type':'Shot','id':123} rather than just the id.
cheers,
kp