I'm creating an animated character which has plenty of hidden artwork (mouth shapes, eyebrow shapes etc). The problem is that whenever I want to move some body part that has hidden child layers, these layers don't move!

E.g. let's say I move the head a couple of pixels to the left. My "natural" mouth artwork moved, but all the other mouth shapes (happy, sad, etc) are in the old head's position!

Did anyone find a way around this?

  • It depends on how you are structuring the layers. If the mouth shapes are all contained in the same sublayer you move the sublayer itself, not the objects within the sublayer.
    – Scott
    Jan 16, 2022 at 21:21
  • Each mouth is in its own sublayer.
    – ranys
    Jan 17, 2022 at 22:00
  • Simply collect them into one sublayer -- sublayers can have sublayers.
    – Scott
    Jan 17, 2022 at 22:02

1 Answer 1


I found a way to achieve this with only 5 steps.

I wrote 2 scripts: one toggles visibility of all sublayers under selected layer, and the other toggle visibility of the selected layer and its first child.

Now, whenever I need to move a layer with hidden sublayers, it takes me 5 steps, 3 of which are mapped to keyboard shortcuts:

  1. Make all sublayers visible (F2)
  2. Select all sublayers by clicking the grey dot
  3. Move
  4. Make all sublayers invisible (F2)
  5. Make selected layer and its first child visible (F3)

Script 1:

// This is a script to toggle visibility of all sublayers under selected layer

var MAX_RECURSION = 10000 // limit recursion size to prevent crashes

var recursionDepth = 0;
var visibility = !activeDocument.activeLayer.visible;

if (recursionDepth > MAX_RECURSION) {
    alert("Warning: partial success")

function toggleVisible(currLayer) {
    currLayer.visible = visibility;

    if (recursionDepth > MAX_RECURSION) {

    if (currLayer.layers != null) {
        for (var i = 0; i < currLayer.layers.length; i++) {

Script 2:

// This is a script to toggle visibility for active layer and first child

currLayer = activeDocument.activeLayer
visibility = !currLayer.visible;

currLayer.visible = visibility;
if (currLayer.layers != null && currLayer.layers.length != 0) 
    currLayer.layers[0].visible = visibility;
enter code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.