Extract Image: Export as flatten image for exr - #137
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The current EXR flattening can permanently flatten the user’s original document in some cases, which is a destructive behavior that should be avoided.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR targets issue #136 by ensuring EXR exports are flattened to avoid failures when publishing selected layers (hidden layers / multi-layer EXR export edge cases) in the Photoshop extension host script.
Changes:
- Adjust EXR export flow to pass the working document into
saveEXR()and flatten before saving. - Bump the extension bundle version in the CSXS manifest.
File summaries
| File | Description |
|---|---|
| client/ayon_photoshop/api/extension/host/index.jsx | Updates EXR saving to flatten before export (via saveEXR(savePath, doc)). |
| client/ayon_photoshop/api/extension/CSXS/manifest.xml | Increments extension bundle version (1.1.17 → 1.1.18). |
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
The new EXR flattening is implemented in a block whose gating logic can unintentionally trigger for non-EXR exports and still won’t flatten 32-bit EXR exports, risking regressions and incomplete bug resolution.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The EXR export path still relies on implicit duplicate() side effects for which document is active, risking saving/flattening the wrong document during saveEXR() execution.
Review details
Suppressed comments (1)
client/ayon_photoshop/api/extension/host/index.jsx:339
saveEXR()saves viaexecuteAction('save', ...), which targets the active Photoshop document. In this EXR branch you manipulate a duplicated document via the localdocvariable, but never explicitly activate it, so the export can accidentally save the wrong document depending onduplicate()side effects. Make the duplicate the active document explicitly before flattening/exporting.
doc = doc.duplicate();
is_temp_doc = true;
doc.bitsPerChannel = BitsPerChannelType.THIRTYTWO;
doc.flatten();
}
- Files reviewed: 2/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
I don't think this entirely the right fix - we may still want to export EXRs with layers, right? Is force flattening it really what we want to do? Is the failure in the error report due to the special character in the layer name? Like Failing on: I'm also a bit confused why it's trying to "open" output file |
This is not the best solution for sure and usually the issue can be fixed when you copy your layers into new project files. I am not the only one who hits the issue, @LiborBatek also got some files hit that error too. Coming up with these changes, I have evaluated the questions below:
The main concern is whether it affects any adjustment on the loaded textures/AOVs. |
|
@LiborBatek can you answer above questions - I'm fine with this 'fix' but I consider it more of a hotfix. Because we may actually want to write out EXRs while maintaining the layers which are now forced to be flattened out, but maybe it's not the top priority - that'd be for you to provide some thoughts on then. |
|
Ok, here is my pov... There is dedicated PS addon product called My recent experience with this product have been - it fails when having configured output to It would be desirable this auto image or implicit publish instance works also in the occasion mentioned above... Regarding workfile layers and how to treat 'em - we should follow the existing procedures/principles we are already using. Maybe there is a one more thing to discuss and that is I hope this enlight it a bit and brought my opinion to the table. |
Changelog Description
This PR is to make sure the image would be exported as flatten image if user choose to use exr. This is to avoid the potential bug where users would save the multiple layers in EXR.
Resolve #136
Additional review information
You need to install extension.zxp to make the flattern option work.
Testing notes:
ayon+settings://photoshop/publish/ExtractImage/formats