Shotgun PhotoshopCC context loss with multiple active files

Hello, I am experiencing loss of context on a project when we open more than one file in PhotoshopCC 2019 using the Shotgun Adobe Panel file integrations. I can open an asset file and save it as a new file, and context displays correctly in the Context Header, particularly the Task (and Step) information. When I open another unrelated asset file and save a new version within the same PS session, context is is updated to the new asset, but the Task info is not displayed. Following that, when I switch back to the original Asset file I have open still, sometimes the context is updated accordingly but is also missing the Task info, but other times remains stuck on the incomplete info from the newer asset, again with no Task info. The behavior is very repeatable, and I get no errors from my console.

Would anyone have any suggestions as to what to look for or try in order to sleuth out the problem? Someone much smarter than me has suggested I add output to context_change.py, to report what I’m actually getting each time I switch active files. Any other suggestions?

Thanks in advance. Michael

2 Likes

I unfortunately have no suggestion but I’m following as we randomly seem to have a similar issue where our Nuke Publish (granted it’s a custom publish hook) picks up the context of the previous publish. And as I havent been able to reproduce it myself I was wondering if this may be a bug somewhere under certain conditions.

2 Likes

To follow up, I have confirmed that it is specific to saving a new file (unconfirmed whether this applies to saving a new version). Using

print engine._CONTEXT_CACHE

in the python console, when I open any published file, the context is good and Task is reported correctly. I can open another published file and both contexts are reported correctly. As soon as I save to a new file, the context is missing the Task information for just the new file. The old published file contexts are still successfully being reported in the cache.

So, is this still buggy, or is this expected behavior with un-published files? I want to say that it’s incorrect/buggy behavior, as you would want to retain Task information for when you actually go to publish the file, so it should still be in context.

1 Like

I also want to confirm that this applies to saving a new version as well. Task context is lost even when simply versioning up a file, whether it is a work or published file.

1 Like

Definitely an issue here.

Here is print engine._CONTEXT_CACHE at each point along the way…

Open file…

{‘/Volumes/droid/XXXX/Assets/Information/J/JadeValleyLayoutSketchA/VisDev/Work/Photoshop/GREM_JadeValleyLayoutSketchA_MicahTest_Vd_v34.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237186, ‘name’: ‘JadeValleyLayoutSketchA’}
Step: {‘type’: ‘Step’, ‘id’: 135, ‘name’: ‘VisualDevelopment’}
Task: {‘type’: ‘Task’, ‘name’: ‘VisDev’, ‘id’: 1693406}
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Task/1693406
Additional Entities:
Source Entity: None>}

Version Up First File…

{‘/Volumes/droid/XXXX/Assets/Information/J/JadeValleyLayoutSketchA/VisDev/Work/Photoshop/GREM_JadeValleyLayoutSketchA_MicahTest_Vd_v33.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237186, ‘name’: ‘JadeValleyLayoutSketchA’}
Step: {‘type’: ‘Step’, ‘id’: 135, ‘name’: ‘VisualDevelopment’}
Task: {‘type’: ‘Task’, ‘name’: ‘VisDev’, ‘id’: 1693406}
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Task/1693406
Additional Entities:
Source Entity: None>}

Shouldn’t the CACHE be updated now?

Load Second File…

{‘/Volumes/droid/XXXX/Assets/Information/J/JadeValleyLayoutSketchA/VisDev/Work/Photoshop/GREM_JadeValleyLayoutSketchA_MicahTest_Vd_v33.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237186, ‘name’: ‘JadeValleyLayoutSketchA’}
Step: {‘type’: ‘Step’, ‘id’: 135, ‘name’: ‘VisualDevelopment’}
Task: {‘type’: ‘Task’, ‘name’: ‘VisDev’, ‘id’: 1693406}
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Task/1693406
Additional Entities:
Source Entity: None>, ‘/Volumes/droid/XXXX/Assets/Characters/T/TestA/Design/Work/Photoshop/GREM_TestA_Poses_Ca_v12.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237948, ‘name’: ‘TestA’}
Step: {‘type’: ‘Step’, ‘id’: 9, ‘name’: ‘Design’}
Task: {‘type’: ‘Task’, ‘name’: ‘Turn’, ‘id’: 1871667}
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Task/1871667
Additional Entities:
Source Entity: None>}

I can see that the context for the previously opened file if wrong. And, if I now switch back to the original file in PS, when the context switches, it is wrong (missing Task because the current path is not in the context and the engine is resolving the context based on the current path).

Now, I save (version up) the second file…

{‘/Volumes/droid/XXXX/Assets/Information/J/JadeValleyLayoutSketchA/VisDev/Work/Photoshop/GREM_JadeValleyLayoutSketchA_MicahTest_Vd_v33.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237186, ‘name’: ‘JadeValleyLayoutSketchA’}
Step: {‘type’: ‘Step’, ‘id’: 135, ‘name’: ‘VisualDevelopment’}
Task: {‘type’: ‘Task’, ‘name’: ‘VisDev’, ‘id’: 1693406}
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Task/1693406
Additional Entities:
Source Entity: None>, ‘/Volumes/droid/XXXX/Assets/Characters/T/TestA/Design/Work/Photoshop/GREM_TestA_Poses_Tn_v01.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237948, ‘name’: ‘TestA’}
Step: {‘type’: ‘Step’, ‘id’: 9, ‘name’: ‘Design’}
Task: None
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Asset/237948
Additional Entities:
Source Entity: None>, ‘/Volumes/droid/XXXX/Assets/Characters/T/TestA/Design/Work/Photoshop/GREM_TestA_Poses_Ca_v12.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237948, ‘name’: ‘TestA’}
Step: {‘type’: ‘Step’, ‘id’: 9, ‘name’: ‘Design’}
Task: {‘type’: ‘Task’, ‘name’: ‘Turn’, ‘id’: 1871667}
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Task/1871667
Additional Entities:
Source Entity: None>, ‘/Volumes/droid/XXXX/Assets/Information/J/JadeValleyLayoutSketchA/VisDev/Work/Photoshop/GREM_JadeValleyLayoutSketchA_MicahTest_Vd_v34.psd’: <Sgtk Context: Project: {‘type’: ‘Project’, ‘id’: 278, ‘name’: ‘Gremlins’}
Entity: {‘type’: ‘Asset’, ‘id’: 237186, ‘name’: ‘JadeValleyLayoutSketchA’}
Step: {‘type’: ‘Step’, ‘id’: 135, ‘name’: ‘VisualDevelopment’}
Task: None
User: {‘type’: ‘HumanUser’, ‘id’: 42, ‘name’: ‘Daniel Eaton’}
Shotgun URL: https://xxx.shotgunstudio.com/detail/Asset/237186
Additional Entities:
Source Entity: None>}

To me it seems that the _CONTEXT_CACHE is not getting updated after versioning up, so as soon as you switch between files in Photoshop the Context (Task) breaks.

At least this is what I am consistently seeing.

Daniel

1 Like

Same goes for Publishing. After a Publish the _CONTEXT_CACHE is not updated and returning to that file from another results in a broken context (missing Task).

Am I just missing something here or is this just plain broke.

Daniel

1 Like

To be more clear. The context.task is correct after a Publish or Save, but when you switch between files and return to it is it wrong.

1 Like

Hi guys – we have an old bug ticket for this, but it may have slipped through the cracks. I’m going to get more info from the engineering team and report back on its status. Clearly if three people are talking about it here, there are even more who are experiencing it. We’ll keep you posted!

1 Like

Thanks Tannaz! Would love to know if it’s a bug in the workfiles app or the photoshop engine. Also do we need to file an official ticket of any sort, or will you finding the old existing one and adding our voices to it be enough?

1 Like

Hiya! The ticket had been closed awhile back when we moved from one system to another. I’ve reopened it, linked this forum post to it, and engineering/product are aware of it. Nothing you guys need to do here; we’ll keep you posted if there’s an update.

1 Like

Also Hey Wilhelmi! Din’t realize this was you! Great to see you here. :blush:

1 Like

I know right?! :slight_smile: I’m here with Daniel for a couple more weeks minimum, then we’ll see if they decide to keep me on longer. My previous experience with Nico at Myth is coming in handy though, so hopefully I prove useful enough to keep around. This Shotgun stuff is still hard…

Thanks again for the help. I hope they can find a simple fix for the context issue so it’s a quick update.

Best,

Michael

2 Likes

Was surprised this issue being still unresolved in the latest ShotGrid version. It seems like tk-photoshopcc did not modify the tk-multi-workfiles2 save_as operation, so I copied the hook and extended it like this

elif operation == "save_as":
    doc = self._get_active_document()
    adobe.save_as(doc, file_path)
    # my hook fix is to call the add_to_context_cache
    self.parent.engine._PhotoshopCCEngine__add_to_context_cache(file_path, context)

Similarly tk-photoshopcc the publish finalize hook ignores the newly created version, so I extended the finalize hook as such

# bump the document path to the next version
# changed the call to store the new version path
next_version_path = self._save_to_next_version(path, item, save_callback)

# our context fixing code simply calls the engine's context function
engine._PhotoshopCCEngine__add_to_context_cache(next_version_path, item.context)

Seems like these quick-fixes solved our problems, even if they are a bit hacky. If it helps someone great, but if you see issues in it I would also be grateful, since I am still getting familiar with the hooks in Photoshop.

Hi, (sorry for the thread resurrect). I am running into this issue currently.

photoshop is losing context when performing save_as and publish actions. the issue only shows itself after switching to another document and back again in photoshop.

I have tried the above fix to override the “save_as” operation in the workfiles2 scene_operation hook (updated slightly to point to adobe engine which seems to be in line with latest)

        elif operation == "save_as":
            doc = self._get_active_document()
            adobe.save_as(doc, file_path)
            # my attempt at implementing the above fix
            adobe.__add_to_context_cache(file_path, context)

however i am getting an error during saving saying “Failed to save file <…> JSON is not seralizable”
the context i am giving it is an incorrect format…

is this fix still the best approach to fixing the losing context issue? or is there a better way?