Mobile app version of vmapp.org
Login or Join
Miguel516

: Is it possible to resynchronize after effects source name with its corresponding photoshop layer name after renaming the source name in after effects? I have an after effects project and a script

@Miguel516

Posted in: #AdobeAfterEffects #AdobePhotoshop

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)?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Miguel516

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie315

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.

10% popularity Vote Up Vote Down


 

@Hamm6457569

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme