1

I have an after effects project and a script that exports the after effects animations for use in Unity3D. The animation is complex and uses over 100 layers. Those layers are imported from a psd file created with photoshop. The layers in after effects and the psd correspond 1 to 1.

The layers from the psd are exported as individual png images. The layer names need to be unique, and the same as the source name in after effects as that is what the export script uses to identify which image is where.

When you import layers from a psd into after effects, it is possible to rename the layers in the psd and after effects source name gets updated automatically. That is until the source name gets renamed in after effects.

Due to a communication mishap, the source names in after effects were all renamed. It is also not desirable to use the backups as that would result in almost a week of lost work.

Some of the psd layer names need to be changed (several of them).

Is it possible to synchronize the names again (psd layer -> after effects source name)?

  • I would like to see the export script. Or if it's a company secret, I'd like to know what is it exactly that fails in the export if the layer name doesn't match the source name. – Joonas Dec 12 '14 at 10:24
1

The only way to "re-synch" a layer with Photoshop, that I know of, is to make sure that the layer name in AE is the same as the source name in AE.

This however is not super pretty, as the layer names would look something like [my layer/my project file.psd] and I'm not sure how your export script would handle it.


I wrote this scrip that will go through every layer and change the layer name if it doesn't match its source name.

Inside the for loop, I put two different ways to change name and I think the latter one, that I left uncommented, is the one that would let you use the export script without any issues.

It doesn't re-synch the layers with photoshop, so this might be something you'd want to run before you run the export script.

The script:

{

    if ( app.project.activeItem ) {

        var project = app.project;
        var comp = project.activeItem;
        var layers = comp.layers;

        // Loop through every layer in the active comp...
        for ( i = 1; i <= layers.length; i++ ) {

            var layer = comp.layer( i );
            var layerName = layer.name;
            var layerSourceName = layer.source.name;

            // If layer name doesn't match the sourcename (minus the psd filename and extension)...
            if ( layerName !== layerSourceName.split('/')[0] ) {

                /* 
                    Replaces the layername with [empty], which will force AE to use the source name. 
                    Stays in synch with Photoshop...
                */

                // layer.name = '';

                /* 
                    Replaces the current filename with the first half of the source name. 
                    Doesn't stay in synch with Photoshop...
                */

                layer.name = layerSourceName.split('/')[0];

            }

        }

    }

}


As it is, the script will change the layer names...

from this:

Layer name       Source name
logo             picture 1/project.psd
animation        character/project.psd

to this:

Layer name       Source name
picture 1        picture 1/project.psd
character        character/project.psd

If you uncomment line 24 and comment line 31, the layer names will go...

from this:

Layer name                  Source name
logo                        picture 1/project.psd
animation                   character/project.psd

to this:

Layer name                  Source name
[picture 1/project.psd]     picture 1/project.psd
[character/project.psd]     character/project.psd

In AE, if layer name has square brackets, it means that it matches the source name.

0

I don't know of any way to do this from with the After Effects UI. It's probably doable with scripting, so this is something that might be worthwhile to ask on the Adobe AE forum.

For a 100+ layer file, I'd estimate it would be a 15-20 minute job to rename all the layers in AE by hand to restore their correspondence to the PSD layer names. Unfortunately, that won't help going forward, because as far as I can tell (I just tested this, because I'd never tried it specifically) the moment you touch the layer name in AE, the connection to the layer name in Ps is broken. At least it avoids losing a week's work, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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