Adding episode to tk-flame-export

Hello all!

Been getting into the thick of the toolkit code but am having trouble setting up a schema using Episode as the parent entity for Shots as opposed to Sequence.
The reason for this is to match our existing folder structure which is organized by episode. The episode name the first token in our sequence name.

I am working with the tk-flame-export toolkit. I have defined Episode in templates.yml and replaced Sequence in the corresponding templates. Also, I have found the relevant portion in the export_preset.py where the template_defs are replaced.

I believe I need to change the “shot_parent_entity_type” but do not know where that setting is. But I am still confused as to why the Episode field from the templates.yml is not working with this line:

template_defs[t] = template_defs[t].replace("{Episode}", "<name>")

Any help is much appreciated! Also it seems difficult to switch from the Sequence based setup. Is switching to Episode / a different shot_parent_entity ill-advised? What other difficulties will I encounter if change the default structure?

Thank you!

if you have an entity field on the Shot where you link to the episode entity for that shot you could add a key to tempates.yml to resolve it from the Shot context.

templates.yml - keys:

    ShotEpisode:
        type: str
        shotgun_entity_type: Shot
        shotgun_field_name: sg_episode.Episode.code

Where sg_episode is the field name on your Shot entity.
This uses deep linking to get the Episode entity linked on the Shot and the code field from that entity link.

Then use ShotEpisode as a key in your path.

Thank you very much! I will give this a go.

1 Like

In case you deeplink Episodes to Shots via a Sequence I think this may also work:

ShotEpisode:
    type: str
    shotgun_entity_type: Shot
    shotgun_field_name: sg_sequence.Sequence.sg_episode.Episode.code

In this case there is a field called sg_sequence on the Shot entity.
The sg_sequence field links to a Sequence which has a field called sg_episode which links to the episode.