0

How to get a information on the linked parent entities

Hi,

Given the simple hierarchy of entities: Project->Sequence->Shot, I can list all shots for the project using 

p = tank.shotgun.find_one('Project',[["name", "is", "My project name"]])
shots = tank.shotgun.find('Shot', [["project", "is", p ]] )

Now, for some of these retrieved shots, I want to find the sequences associated with them. How can I do that?

2 comments

  • 0
    Avatar
    Kym Watts

    Hey Sergiy,

    What field code do you use to link shots to sequences. once you know that you could do something like the following.

    The call you could do would look something link this if its a entity link:

    shots = tank.shotgun.find('Shot', [["project", "is", p ]] ,['<field_name>'])

    then :

    for shot_entity in shots:

        # then this call would give you the sequence entity that is linked to the current shot

        sequence_entity = shot_entity.get('<field_name>')

        # you could then get the sequence name if its not already returned in the sequence_entity.

        sequence_entity = tank.shotgun.find('Sequence',[['id,'is',sequence_entity.get('id')]],['code'])

        sequence_code = sequence_entity.get('code')

        # where code is the field name that you want to know sequence name.

     

    hope that helps

  • 0
    Avatar
    Sergiy Samus

    It does help! I Thank you!

Please sign in to leave a comment.