Skip to main content
stib
Inspiring
May 6, 2019
質問

How to tell if footageSource is a layer of a file (e.g. a .psd layer or .ai layer)

I want to duplicate a footageSource object, and I'm using something like this:

var oldSource = originalLayer.source;

newSource = app.project.importFile(new ImportOptions(oldSource.file));

This works fine if the original source is a flat file, like a jpg or movie file, but if it's a layer of a Photoshop image or Illustrator file it imports the whole file instead of just the layer. There doesn't seem to be any way to query a footageSource object to see if it's a layer of a multi-layer file, or not.

ImportOptions has an ImportOptions.importAs attribute, which means if I know whether the file is a layer I can specify

    ImportAsType.COMP_CROPPED_LAYERS

    ImportAsType.FOOTAGE

    ImportAsType.COMP

    ImportAsType.PROJECT

But the import type of a footage source doesn't seem to be part of the footageSource object.

このトピックへの返信は締め切られました。

返信数 4

Participant
May 20, 2023

Hi, after lots and lots of searching, I found a way to do it, not as straight forward but at least it works: basically, it involves saving the aep as xml (aepx) and from there you can simply replace the paths to the psd files. If you want, you can then save it back to .aep.

The whole context of my particular scenario:

* find missing footage
* replace everything but the psd files, which will be colleted in an array for later use
* save an xml file at this stage (son only the psd files will be missing)
* read the xml file, find and replace the psd paths. It will keep all layers and their original names in the comp (even if the user manually changed them)
* save the changes to the file
if you want, save the file to binary (aep) again.

Hope that helps

Participant
April 18, 2023

I'm running into this issue as well. Hope that adobe will add the ability to be able to replace the source files with layers of a file instead of just being able to replace flat files.

konstantinr76803912
Participating Frequently
January 23, 2022

I have run into the same problem. If there is any new information out, I'd be happy know about it.

My last knowledge is to import the new file as a comp, then compare the name of the new items with the item you want to replace. But we run into a problem if a project item is renamed afterwards.

Meng Zhiqun
Inspiring
December 10, 2021

Hi stib,

Just wondering if you have found the answer for this besides the method to find "/" in the item name to show that it's a layer?