'Hooking' Photoshop's context switching

Good afternoon everyone.

In our pipeline we deal with a LOT of Photoshop documents and Artists like to have multiple documents open at once. It also seems that the multi-document workflow inside the Photoshop engine is a little hit-or-miss.

For example, our templates use Steps. And it seems that when the engine tries to resolve a Context/Task for a path it only has access to the Context/Step information and ignores the Task associtated with the Published File it is trying to get a context for. So for Assets that have Pipeline Steps with mulitiple Tasks it gets confused. For Assets with only one Task per Pipeline Step it seems to do a better job getting the ‘correct’ context from the current active document.

If we used Tasks rather that Steps in our templates that seems like is would help because at lease the schema would have the Tasks rather than the Step (with multiple possible Tasks), but that is not an option right now.

So it seems that if we could ‘hook’ the context-switching behavior with out own ‘brute force’ code we could get around one of our current multi-document issues. We have a token for the Task in our filename so we could always use a work template (to get the Task Name) to return the correct context rather that just having to live with the wrong (Asset only, no Task) context from tk.

Is anything like this possible?
Where in tk is this actually happening? I don’t see it in the Engines, must be buried in TK.
What is up with the CONTEXT_CACHE? I have tried to solve the issue by manually ‘updating’ the cache with the ‘correct’ context

I have a tk-photoshopcc-app that ‘fixes’ broken contexts based on the above ‘brute force’ approach so I know that it can work, I just need to know where it plug in it.

This is related to Shotgun PhotoshopCC context loss with multiple active files


1 Like

Hi Daniel – You mention that you have Task and Steps in your templates. Can you clarify a little? Do you have them both in your schema (ie, in the folder structure), or just in the file name?

Toolkit relies on the path cache for information about the mapping between folders on disk and entities in Shotgun, and the path cache data is generated at folder creation time.

It uses the path cache info to build the context, and it uses the context to resolve template keys.

So, unfortunately, if you don’t have an entity represented in your schema, you won’t be able to reliably use it in file names. There are some smarts built in, as you’ve noticed, for the case where there’s only a single task under a step. But if there are more, it’s ambiguous.

Might that be what you’re hitting?

1 Like