Skip to main content
Participant
July 22, 2020
Answered

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

  • July 22, 2020
  • 3 replies
  • 2013 views

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!

This topic has been closed for replies.
Correct answer Dan Ebberts

I think it would be like this:

 

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

 

Dan

3 replies

anchpopAuthor
Participant
July 24, 2020

Thank you, it worked like a charm!

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
July 23, 2020

I think it would be like this:

 

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

 

Dan

Mylenium
Legend
July 23, 2020

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

 

Mylenium

anchpopAuthor
Participant
July 23, 2020

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