Core hooks are powerful and there are some docs around them, but I often find myself asking, “When exactly is this called?” and I have to do a lot of experimenting to figure out the best core hook to override to do what I need.
Specifically, I’m wondering about the following:
The main question I have is around more of the start-up and launching workflow. Specifically these:
So in general, yes I know when they are fired. But I’m less sure when they’re called in relation to the overall bootstrap process. It would be great to have a bit more of a specific timeline, diagraming when each of these is called in relation to the artist workflow in SG Desktop or the Shotgun engine. I’m typically trying to setup something or ensure an env var is set so I can act on it before artists launch into their DCC or custom TK app. Maybe there are other core hooks that get run between SG Desktop login and loading the PC for their project? I don’t know.
Also important to highlight is when they are called multiple times in the workflow of an artist logging in to SG Desktop and then clicking on their Project.
Finally, how this may differ if an artist is launching from Shotgun or the shell, or if there are similar workflows that may NOT fire the core hook, that we should watch out for.
Fair enough… perhaps in the meantime I could put forth my hypothetical situation that brought on this question?
We have 2 different types of projects at a studio. Both use the same exact config. The only difference between the two is the templates. Ideally it’d be nice to not have to manage 2 separate configs for this (especially since the templates also overlap about 95%). So I have been experimenting with using an environment variable to designate what template should be used.
I’m currently using the bootstrap.py core hook that looks at the “Type” field on the SG Project for the current pipeline config and sets the env variable. Then I have a single template file core/templates.yml that includes another template file based on that environment variable.
This works well at first when you load things up in SG Desktop , but then if you click out of the Project and back in, it fails to set the env variable . So I don’t have the right place for this logic. It also seems to fail in the Shotgun engine in some cases.
So… where would the right place for this logic be where I know my pipeline config but before anything has actually be initialized/verified? And how can I ensure it will be run every time?’’