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

Engaged ,
May 05, 2019 May 05, 2019

Copy link to clipboard

Copied

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.

TOPICS
Scripting

Views

334

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 10, 2021 Dec 10, 2021

Copy link to clipboard

Copied

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?

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 23, 2022 Jan 23, 2022

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines