Photoshop CC: Merge enables visibility of unrelated Layer Sets (JavaScript)

  • 1
  • Problem
  • Updated 4 years ago
  • Acknowledged
  • (Edited)
Merge has unexpected behavior in JavaScript.
If you have a hidden layer-set (folder/group) selected and you merge another deselected layer-set. The selected layer set will become visible.
The expected behavior would be that merging should not affect visibility states, especially of other objects.
Tested using Photoshop CC 14.2.1 x64
Photo of martin akesson

martin akesson

  • 2 Posts
  • 0 Reply Likes
  • confused

Posted 4 years ago

  • 1
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 836 Reply Likes
Have you tested this in the current version of Photoshop (15.2.2)?
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 15232 Posts
  • 2191 Reply Likes
Do you have a test script we could use to repro?
Photo of martin akesson

martin akesson

  • 2 Posts
  • 0 Reply Likes
So I got what I think is the latest version 2014.2.2 (20141204.r.310 x64) and tested it in there. It yields the same result.
Unfortunately I can't share the entire script, but I can share the part that is causing me issues. What this function does is that it takes a layer set that always is placed inside another layerset, merges it, then copies the result into the alpha channel. This function takes two arguments first the document and then a layerset.

If you set up a document with the hierarchy illustrated below. Then execute the function with "Set1" or "Set2" selected. If they are hidden they will become visible, which is very unexpected. However here is a workaround that makes it behave as expected and that is to set the selection to be the layer that is being merged. That would be the line that's commented out.

Document Hierarchy
|-- Set1
| |-- Layer 1
| |-- Layer 2
| |-- Layer 3
| `-- Layer 4
|-- Set2
| |-- Layer 5
| `-- Layer 6
`-- Set3
|-- Layer 7
|-- Layer 8
`-- SetToAlpha
|-- Layer 10
`-- Layer11

function copySetIntoAlpha(document,set){
document.channels.removeAll();
set.visible=true;
var currentChannelSetDuplicate=set.duplicate();
var alpha=null;
try{
//document.activeLayer = currentChannelSetDuplicate;
alpha=currentChannelSetDuplicate.merge();
}catch(e){
alert('Layerset was empty. Add a layer to the set.');
return false;
}
set.visible=false;
alpha.copy();
alpha.remove();
document.channels.add();
document.paste();
return true;
}
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 15232 Posts
  • 2191 Reply Likes
Official Response
Thanks. Our eng team is looking into this.