Copy n effects off of a source layer onto target layers?
Posted: April 21st, 2008, 9:57 am
Hello all - I was wondering if you knew a robust way to use a script to copy effects(including keyframes) from a template layer onto a number of target layers. I have been fiddling with CreateLinkedEffects but I seem to butt my head up against how to create or manipulate arrays of effects, or even applying one set from a custom layer. Many of the examples I've been able to find only refer to built in ae effects like myLayer.addProperty("Levels")
I took a look at animation presets but it seems like overkill to use menu commands to save and load them, after all that gets into file I/O.
Pseudocode for what I'd like to get working would be like this:
Locate "TemplateComp"
Find "FXLayer"
Copy any effects from FXLayer into an array
Copy properties and keys into a subarray
Apply all effects in the array to all selected layers in a different comp
Apply properties and keys to new effects on each layer.
Adjust properties of the effects to be relevant to the target layers (for example, perhaps a Bulge Center property)
I have all of this up and running except for how to copy these pesky effects. There seems to be something fundamental I don't understand about how to address properties.
This code works:
but this doesn't:
because FXLayer.Effects.length returns an undefined. I've tried many other syntaxes as well with no luck. Does anyone have a sample script that does something like this that I could take a look at, or at least a nudge in the right direction? Thanks in advance.
I took a look at animation presets but it seems like overkill to use menu commands to save and load them, after all that gets into file I/O.
Pseudocode for what I'd like to get working would be like this:
Locate "TemplateComp"
Find "FXLayer"
Copy any effects from FXLayer into an array
Copy properties and keys into a subarray
Apply all effects in the array to all selected layers in a different comp
Apply properties and keys to new effects on each layer.
Adjust properties of the effects to be relevant to the target layers (for example, perhaps a Bulge Center property)
I have all of this up and running except for how to copy these pesky effects. There seems to be something fundamental I don't understand about how to address properties.
This code works:
Code: Select all
var growEffect = FXLayer.effect(1);
Code: Select all
for ( var i = 0 ; i < FXLayer.Effects.length; i++ )
{
myEffect = FXLayer.Effects;
myEffectArray[myAffectArray.length] = myEffect;
}