Skip to main content
Lukas Engqvist
Community Expert
Community Expert
May 10, 2021
解決済み

How to toggle visibility of groups when reorganising layers

  • May 10, 2021
  • 返信数 2.
  • 2718 ビュー

An action that organises layers in groups has very different behaviour if a group is toggled open or closed. If a group above a layer is closed moving a layer upp will skip the group, but if the group is toggled open then the layer will be moved to the bottom of that stack. I am not finding a command that will reliably open or close a group so that the action can be guaranteed to give consisten result. How do others ensure that a layer is placed in above or below a specific layer. Changing layer order gives sets the layer to a layer number, I want it to be above or below a specific layer in a group. Please advise.

このトピックへの返信は締め切られました。
解決に役立った回答 Kukurykus

 

for(i = 0; i < (lrs = (aL = (aD = activeDocument).activeLayer).parent.layers).length; i++) {
	if (lrs[i] == aL) {i && aL.move(lrs[i - 1], ElementPlacement.PLACEBEFORE); break}
}

 

返信数 2

Kukurykus
Kukurykus解決!
Legend
May 11, 2021

 

for(i = 0; i < (lrs = (aL = (aD = activeDocument).activeLayer).parent.layers).length; i++) {
	if (lrs[i] == aL) {i && aL.move(lrs[i - 1], ElementPlacement.PLACEBEFORE); break}
}

 

Lukas Engqvist
Community Expert
Community Expert
May 15, 2021

@Kukurykus Not sure how to use the code… I guess it is JavaScript? Are groups treated differently there? I don't know how this could help in recording actions.

Kukurykus
Legend
May 15, 2021

Save my code to MoveOverGroup.jsx in Presets / Scripts of your Ps folder and (re)launch Ps.

Add a shortcut to MoveOverGroup item from File / Scripts menu by Edit / Keyboards menu.

(Or better create an Action and Insert Menu Item to it from File / Scripts named like the file)

To use it first select a layer that's under (un)open group. It's going to be moved over layerSet.

Lukas Engqvist
Community Expert
Community Expert
May 10, 2021

Did find a workaround, in how I crated the script. There is an option to "Collapse all groups" option in from the layers panel which means there is an absolute state to return to. Also if you select a named layer inside a group the group will expand.

 

My problem when recordin the script is that I was initially creating the "layer structure" by creating empty groups and then trying to fill them. Switching the workflow to first create the named layers and then group them got around the limitation of "expanding" empty groups so that layers can be placed inside these groups.

What is possible in a manual workflow isn't allways recordable.

(Did notice another "bug" and that is that the black and white filter was not always recording all values. I had to repeatedly record the adjustment and double check that all values actually stuck… but I guess that needs another thread)

PECourtejoie
Community Expert
Community Expert
May 11, 2021

Lukas, did you log both bugs on  the https://feedback.photoshop.com ?