Highlighted

Use Extendscript to add a (adjustment) layer to a comp?

New Here ,
Jul 22, 2020

Copy link to clipboard

Copied

I'm trying to programmatically add an adjustment layer to my comp. The adjustment layer creates a vignette effect, and is inside another comp inside another project (vignetteProject). Here is my code:

var vignetteComp = vignetteProject.item(vignetteIndex)
comp.layers.add(vignetteComp.layer(1))

On the second line here, I get an error reading "unable to call 'add' because of parameter 1. [object AVLayer] is not of the correct type". 

I believe it is expecting an AVItem, not an AVLayer. But if that's the case, how am I supposed to add an adjustment layer?

 

Thank you!

I think it would be like this:

 

vignetteProject.item(vignetteIndex).layer(1).copyToComp(comp)

 

Dan

Topics

Error or problem, How to, Scripting, SDK

Views

54

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

Use Extendscript to add a (adjustment) layer to a comp?

New Here ,
Jul 22, 2020

Copy link to clipboard

Copied

I'm trying to programmatically add an adjustment layer to my comp. The adjustment layer creates a vignette effect, and is inside another comp inside another project (vignetteProject). Here is my code:

var vignetteComp = vignetteProject.item(vignetteIndex)
comp.layers.add(vignetteComp.layer(1))

On the second line here, I get an error reading "unable to call 'add' because of parameter 1. [object AVLayer] is not of the correct type". 

I believe it is expecting an AVItem, not an AVLayer. But if that's the case, how am I supposed to add an adjustment layer?

 

Thank you!

I think it would be like this:

 

vignetteProject.item(vignetteIndex).layer(1).copyToComp(comp)

 

Dan

Topics

Error or problem, How to, Scripting, SDK

Views

55

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
Most Valuable Participant ,
Jul 22, 2020

Copy link to clipboard

Copied

You're going about this the wrong way. Create an animation preset and add a solid onto which the preset is applied.

 

Mylenium

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
Reply
Loading...
New Here ,
Jul 23, 2020

Copy link to clipboard

Copied

Okay, I'll try that! Disappointed that there's no way to add a layer from one comp onto another directly though.

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
Reply
Loading...
Guide ,
Jul 23, 2020

Copy link to clipboard

Copied

I think it would be like this:

 

vignetteProject.item(vignetteIndex).layer(1).copyToComp(comp)

 

Dan

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
Reply
Loading...
anchpop LATEST
New Here ,
Jul 23, 2020

Copy link to clipboard

Copied

Thank you, it worked like a charm!

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
Reply
Loading...